mirror of
				https://github.com/hzyitc/openwrt-redmi-ax3000
				synced 2025-10-30 07:50:32 +08:00 
			
		
		
		
	scripts/mkits.sh: move out .pagesync generation for RootFS blob
It's expected the mkits.sh script to generate only the relevant DTS entry and have all the blob already prepared to use for mkimage. This is not the case for the RootFS case where the script generates a .pagesync with the dd command. To better handle this, drop the dd command and instead error out if the .pagesync blob is not found if RootFS is used. Adapt the generic fit build in image-commands.mk to call the dd for .pagesync right before mkits.sh. Link: https://github.com/openwrt/openwrt/pull/20492 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
		| @ -431,24 +431,27 @@ define Build/initrd_compression | |||||||
| endef | endef | ||||||
|  |  | ||||||
| define Build/fit | define Build/fit | ||||||
| 	$(call locked,$(TOPDIR)/scripts/mkits.sh \ | 	$(call locked, { \ | ||||||
| 		-D $(DEVICE_NAME) -o $@.its -k $@ \ | 		$(if $(findstring with-rootfs,$(word 3,$(1))),dd if=$(IMAGE_ROOTFS) of=$(IMAGE_ROOTFS).pagesync bs=4096 conv=sync;) \ | ||||||
| 		-C $(word 1,$(1)) \ | 		$(TOPDIR)/scripts/mkits.sh \ | ||||||
| 		$(if $(word 2,$(1)),\ | 			-D $(DEVICE_NAME) -o $@.its -k $@ \ | ||||||
| 			$(if $(findstring 11,$(if $(DEVICE_DTS_OVERLAY),1)$(if $(findstring $(KERNEL_BUILD_DIR)/image-,$(word 2,$(1))),,1)), \ | 			-C $(word 1,$(1)) \ | ||||||
| 				-d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))), \ | 			$(if $(word 2,$(1)),\ | ||||||
| 				-d $(word 2,$(1)))) \ | 				$(if $(findstring 11,$(if $(DEVICE_DTS_OVERLAY),1)$(if $(findstring $(KERNEL_BUILD_DIR)/image-,$(word 2,$(1))),,1)), \ | ||||||
| 		$(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \ | 					-d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))), \ | ||||||
| 		$(if $(findstring with-initrd,$(word 3,$(1))), \ | 					-d $(word 2,$(1)))) \ | ||||||
| 			$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \ | 			$(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \ | ||||||
| 				-i $(KERNEL_BUILD_DIR)/initrd$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))).cpio$(strip $(call Build/initrd_compression)))) \ | 			$(if $(findstring with-initrd,$(word 3,$(1))), \ | ||||||
| 		-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ | 				$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \ | ||||||
| 		$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ | 					-i $(KERNEL_BUILD_DIR)/initrd$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))).cpio$(strip $(call Build/initrd_compression)))) \ | ||||||
| 		$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \ | 			-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ | ||||||
| 		$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \ | 			$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ | ||||||
| 		$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \ | 			$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \ | ||||||
| 		-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ | 			$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \ | ||||||
| 		-A $(LINUX_KARCH) -v $(LINUX_VERSION), gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))) | 			$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \ | ||||||
|  | 			-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ | ||||||
|  | 			-A $(LINUX_KARCH) -v $(LINUX_VERSION) \ | ||||||
|  | 	}, gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))) | ||||||
| 	$(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ | 	$(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ | ||||||
| 		-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new, \ | 		-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new, \ | ||||||
| 	  gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))) | 	  gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))) | ||||||
|  | |||||||
| @ -82,6 +82,11 @@ if [ -z "${ARCH}" ] || [ -z "${COMPRESS}" ] || [ -z "${LOAD_ADDR}" ] || \ | |||||||
| 	usage | 	usage | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | if [ -n "${ROOTFS}" ] && [ ! -f "${ROOTFS}".pagesync ]; then | ||||||
|  | 	echo "Missing .pagesync blob for RootFS blob '${ROOTFS}'" | ||||||
|  | 	exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
| ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]') | ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]') | ||||||
|  |  | ||||||
| if [ -n "${COMPATIBLE}" ]; then | if [ -n "${COMPATIBLE}" ]; then | ||||||
| @ -136,7 +141,6 @@ fi | |||||||
|  |  | ||||||
|  |  | ||||||
| if [ -n "${ROOTFS}" ]; then | if [ -n "${ROOTFS}" ]; then | ||||||
| 	dd if="${ROOTFS}" of="${ROOTFS}.pagesync" bs=4096 conv=sync |  | ||||||
| 	ROOTFS_NODE=" | 	ROOTFS_NODE=" | ||||||
| 		rootfs${REFERENCE_CHAR}$ROOTFSNUM { | 		rootfs${REFERENCE_CHAR}$ROOTFSNUM { | ||||||
| 			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} rootfs\"; | 			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} rootfs\"; | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Christian Marangi
					Christian Marangi