[Feature][ZXW-130]merge P50U02 version

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I4f29ec5bb7c59385f23738d2b7ca84e67c100f69
diff --git a/ap/Makefile b/ap/Makefile
old mode 100644
new mode 100755
index 9ae3d80..0e5fed9
--- a/ap/Makefile
+++ b/ap/Makefile
@@ -174,7 +174,11 @@
 	cp -v $(LINUX_DIR)/arch/arm/boot/uImage  $(IMAGE_DIR)/linux_kernel.img
 ifeq ($(CONFIG_SIGN_IMAGE),yes)
 	chmod a+x $(SIGN)
-	@$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(PRIVATE_KEY_PATH)
+	mkimage -A arm -O linux -C none  -T filesystem -a 0 -e 0 -n 'rootfs' -d $(IMAGE_DIR)/rootfs.img $(IMAGE_DIR)/rootfs_u.img
+	@$(SIGN) -i $(IMAGE_DIR)/rootfs_u.img  -o $(IMAGE_DIR)/rootfs_signed.img  -k $(PRIVATE_KEY_PATH)
+	dd if=$(IMAGE_DIR)/rootfs_signed.img of=$(IMAGE_DIR)/rootfs.sign bs=704 count=1
+	cat $(IMAGE_DIR)/rootfs.sign  $(IMAGE_DIR)/linux_kernel.img  >  $(IMAGE_DIR)/rootfs_kernel.img
+	@$(SIGN) -i $(IMAGE_DIR)/rootfs_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin -k $(PRIVATE_KEY_PATH)
 else
 	@cp -v $(IMAGE_DIR)/linux_kernel.img      $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
 endif
@@ -683,7 +687,11 @@
 	cp -v $(IMAGE_DIR)/rootfs.img $(PRJ_BIN_DIR)/allbins/ap_rootfs.img
 ifeq ($(CONFIG_SIGN_IMAGE),yes)
 	chmod a+x $(SIGN)
-	@$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(PRIVATE_KEY_PATH)
+	mkimage -A arm -O linux -C none  -T filesystem -a 0 -e 0 -n 'rootfs' -d $(IMAGE_DIR)/rootfs.img $(IMAGE_DIR)/rootfs_u.img
+	@$(SIGN) -i $(IMAGE_DIR)/rootfs_u.img  -o $(IMAGE_DIR)/rootfs_signed.img  -k $(PRIVATE_KEY_PATH)
+	dd if=$(IMAGE_DIR)/rootfs_signed.img of=$(IMAGE_DIR)/rootfs.sign bs=704 count=1
+	cat $(IMAGE_DIR)/rootfs.sign  $(IMAGE_DIR)/linux_kernel.img  >  $(IMAGE_DIR)/rootfs_kernel.img
+	@$(SIGN) -i $(IMAGE_DIR)/rootfs_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin -k $(PRIVATE_KEY_PATH)
 else
 	@cp -v $(IMAGE_DIR)/linux_kernel.img      $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
 endif
@@ -703,7 +711,7 @@
 	cp -v $(IMAGE_DIR)/ap_caprootfs.img $(PRJ_BIN_DIR)/allbins/
 ifeq ($(CONFIG_SIGN_IMAGE),yes)
 	chmod a+x $(SIGN)
-	@$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin $(PRIVATE_KEY_PATH)
+	@$(SIGN) -i $(IMAGE_DIR)/linux_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin -k $(PRIVATE_KEY_PATH)
 else
 	@cp -v $(IMAGE_DIR)/linux_kernel.img      $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin
 endif
@@ -725,7 +733,7 @@
 endif
 ifeq ($(CONFIG_SIGN_IMAGE),yes)
 	chmod a+x $(SIGN)
-	@$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_recovery.bin $(PRIVATE_KEY_PATH)
+	@$(SIGN) -i $(IMAGE_DIR)/linux_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_recovery.bin -k $(PRIVATE_KEY_PATH)
 else
 	@cp -v $(IMAGE_DIR)/linux_kernel.img      $(PRJ_BIN_DIR)/allbins/ap_recovery.bin
 endif
@@ -747,7 +755,7 @@
 	$(CROSS_COMPILE)objcopy -O binary -j .modem.text $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/allbins/modem_code.bin
 	$(CROSS_COMPILE)objcopy -O binary -R .modem.text $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/allbins/ap_tmp.bin
 	./os/linux/linux-3.4.x/scripts/mkuboot.sh -A arm -O linux -C none  -T kernel -a 0x205c8000 -e 0x205c8000 -n 'Linux-3.4.110-rt140' -d $(PRJ_BIN_DIR)/allbins/ap_tmp.bin $(PRJ_BIN_DIR)/allbins/uap_tmp.bin
-	@$(SIGN) -s $(PRJ_BIN_DIR)/allbins/uap_tmp.bin $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(PRIVATE_KEY_PATH)
+	@$(SIGN) -i $(PRJ_BIN_DIR)/allbins/uap_tmp.bin -o $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin -k $(PRIVATE_KEY_PATH)
 	cp -v $(PRJ_BIN_DIR)/allbins/modem_code.bin  $(ROOTFS_DIR)/bin/
 	rm -frv $(PRJ_BIN_DIR)/allbins/uap_tmp.bin
 	rm -frv $(PRJ_BIN_DIR)/allbins/ap_tmp.bin