X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=include%2Fimage.mk;h=8b183ab58a839bbf936526411f9aafcdc1366ba6;hp=261f0f8aeaa1e88d8e5c9aad6a8f673ff1d6a79f;hb=d1ae4c4958e6394a0f00be334bc045bce9f0614d;hpb=14b40d61e13ce0408d5ed9dff2ad3a18ab0c2471 diff --git a/include/image.mk b/include/image.mk index 261f0f8aea..8b183ab58a 100644 --- a/include/image.mk +++ b/include/image.mk @@ -244,26 +244,12 @@ E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024))) define Image/mkfs/ext4 $(STAGING_DIR_HOST)/bin/make_ext4fs \ -l $(E2SIZE) -b $(CONFIG_TARGET_EXT4_BLOCKSIZE) \ - -i $(CONFIG_TARGET_EXT4_MAXINODE) \ - -m $(CONFIG_TARGET_EXT4_RESERVED_PCT) \ + $(if $(CONFIG_TARGET_EXT4_RESERVED_PCT),-m $(CONFIG_TARGET_EXT4_RESERVED_PCT)) \ $(if $(CONFIG_TARGET_EXT4_JOURNAL),,-J) \ $(if $(SOURCE_DATE_EPOCH),-T $(SOURCE_DATE_EPOCH)) \ $@ $(call mkfs_target_dir,$(1))/ endef -define Image/mkfs/prepare/default - # Use symbolic permissions to avoid clobbering SUID/SGID/sticky bits - - $(FIND) $(1) -type f -not -perm /0100 -not -name 'ssh_host*' -not -name 'shadow' -print0 | $(XARGS) -0 chmod u+rw,g+r,o+r - - $(FIND) $(1) -type f -perm /0100 -print0 | $(XARGS) -0 chmod u+rwx,g+rx,o+rx - - $(FIND) $(1) -type d -print0 | $(XARGS) -0 chmod u+rwx,g+rx,o+rx - $(INSTALL_DIR) $(1)/tmp $(1)/overlay - chmod 1777 $(1)/tmp -endef - -define Image/mkfs/prepare - $(call Image/mkfs/prepare/default,$(1)) -endef - define Image/Manifest $(STAGING_DIR_HOST)/bin/opkg \ --offline-root $(TARGET_DIR) \ @@ -293,27 +279,23 @@ mkfs_cur_target_dir = $(call mkfs_target_dir,pkg=$(target_params)) opkg_target = \ $(call opkg,$(mkfs_cur_target_dir)) \ - -f $(mkfs_cur_target_dir).conf \ - -l $(mkfs_cur_target_dir).tmp + -f $(mkfs_cur_target_dir).conf target-dir-%: FORCE rm -rf $(mkfs_cur_target_dir) $(mkfs_cur_target_dir).opkg - $(CP) $(TARGET_DIR) $(mkfs_cur_target_dir) - mv $(mkfs_cur_target_dir)/etc/opkg $(mkfs_cur_target_dir).opkg + $(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir) + -mv $(mkfs_cur_target_dir)/etc/opkg $(mkfs_cur_target_dir).opkg echo 'src default file://$(PACKAGE_DIR_ALL)' > $(mkfs_cur_target_dir).conf + $(if $(mkfs_packages_remove), \ + -$(call opkg,$(mkfs_cur_target_dir)) remove \ + $(mkfs_packages_remove)) $(if $(call opkg_package_files,$(mkfs_packages_add)), \ $(opkg_target) update && \ $(opkg_target) install \ $(call opkg_package_files,$(mkfs_packages_add))) - $(if $(mkfs_packages_remove), \ - $(call opkg,$(mkfs_cur_target_dir)) remove \ - $(mkfs_packages_remove)) - $(call Image/mkfs/prepare,$(mkfs_cur_target_dir)) $(call prepare_rootfs,$(mkfs_cur_target_dir)) - mv $(mkfs_cur_target_dir).opkg $(mkfs_cur_target_dir)/etc/opkg - rm -rf \ - $(mkfs_cur_target_dir).conf \ - $(mkfs_cur_target_dir).tmp + -mv $(mkfs_cur_target_dir).opkg $(mkfs_cur_target_dir)/etc/opkg + rm -f $(mkfs_cur_target_dir).conf $(KDIR)/root.%: kernel_prepare $(call Image/mkfs/$(word 1,$(target_params)),$(target_params)) @@ -390,11 +372,21 @@ else DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_$(1)) endif +DEVICE_EXTRA_PACKAGES = $(call qstrip,$(CONFIG_TARGET_DEVICE_PACKAGES_$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_DEVICE_$(1))) + +define merge_packages + $(1) := + $(foreach pkg,$(2), + $(1) := $$(strip $$(filter-out -$$(patsubst -%,%,$(pkg)) $$(patsubst -%,%,$(pkg)),$$($(1))) $(pkg)) + ) +endef + define Device/Check/Common _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile)))) ifdef TARGET_PER_DEVICE_ROOTFS - ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(DEVICE_PACKAGES))) - PACKAGES_$$(ROOTFS_ID/$(1)) := $$(DEVICE_PACKAGES) + $$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1)))) + ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(_PACKAGES))) + PACKAGES_$$(ROOTFS_ID/$(1)) := $$(_PACKAGES) endif endef @@ -523,7 +515,7 @@ define BuildImage image_prepare: ifeq ($(IB),) - .PHONY: download prepare compile clean image_prepare mkfs_prepare kernel_prepare install install-images + .PHONY: download prepare compile clean image_prepare kernel_prepare install install-images compile: $(call Build/Compile) @@ -542,10 +534,7 @@ define BuildImage mkdir -p $(BIN_DIR) $(KDIR)/tmp endif - mkfs_prepare: image_prepare - $(call Image/mkfs/prepare,$(TARGET_DIR)) - - kernel_prepare: mkfs_prepare + kernel_prepare: image_prepare $(call Image/Build/targz) $(call Image/Build/cpiogz) $(call Image/BuildKernel)