diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/common.mk | 27 | ||||
-rw-r--r-- | fs/cpio/cpio.mk | 11 | ||||
-rw-r--r-- | fs/ext2/ext2.mk | 10 | ||||
-rw-r--r-- | fs/initramfs/initramfs.mk | 22 | ||||
-rw-r--r-- | fs/iso9660/iso9660.mk | 2 |
5 files changed, 41 insertions, 31 deletions
diff --git a/fs/common.mk b/fs/common.mk index 5b612a3f41..c17c4585ff 100644 --- a/fs/common.mk +++ b/fs/common.mk @@ -19,10 +19,6 @@ # ROOTFS_$(FSTYPE)_POST_GEN_HOOKS, a list of hooks to call after # generating the filesystem image # -# ROOTFS_$(FSTYPE)_POST_TARGETS, the list of targets that should be -# run after running the main filesystem target. This is useful for -# initramfs, to rebuild the kernel once the initramfs is generated. -# # In terms of configuration option, this macro assumes that the # BR2_TARGET_ROOTFS_$(FSTYPE) config option allows to enable/disable # the generation of a filesystem image of a particular type. If @@ -31,11 +27,12 @@ # BR2_TARGET_ROOTFS_$(FSTYPE)_LZMA exist and are enabled, then the # macro will automatically generate a compressed filesystem image. -FAKEROOT_SCRIPT = $(BUILD_DIR)/_fakeroot.fs -FULL_DEVICE_TABLE = $(BUILD_DIR)/_device_table.txt +FS_DIR = $(BUILD_DIR)/buildroot-fs +FAKEROOT_SCRIPT = $(FS_DIR)/fakeroot.fs +FULL_DEVICE_TABLE = $(FS_DIR)/device_table.txt ROOTFS_DEVICE_TABLES = $(call qstrip,$(BR2_ROOTFS_DEVICE_TABLE) \ $(BR2_ROOTFS_STATIC_DEVICE_TABLE)) -USERS_TABLE = $(BUILD_DIR)/_users_table.txt +USERS_TABLE = $(FS_DIR)/users_table.txt ROOTFS_USERS_TABLES = $(call qstrip,$(BR2_ROOTFS_USERS_TABLES)) # Since this function will be called from within an $(eval ...) @@ -73,9 +70,8 @@ endif $$(BINARIES_DIR)/rootfs.$(1): target-finalize $$(ROOTFS_$(2)_DEPENDENCIES) @$$(call MESSAGE,"Generating root filesystem image rootfs.$(1)") $$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),$$(call $$(hook))$$(sep)) - rm -f $$(FAKEROOT_SCRIPT) - rm -f $$(TARGET_DIR_WARNING_FILE) - rm -f $$(USERS_TABLE) + rm -rf $(FS_DIR) + mkdir -p $(FS_DIR) echo '#!/bin/sh' > $$(FAKEROOT_SCRIPT) echo "set -e" >> $$(FAKEROOT_SCRIPT) echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT) @@ -104,9 +100,9 @@ endif $$(foreach hook,$$(ROOTFS_POST_CMD_HOOKS),\ $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep)) chmod a+x $$(FAKEROOT_SCRIPT) + rm -f $$(TARGET_DIR_WARNING_FILE) PATH=$$(BR_PATH) $$(HOST_DIR)/bin/fakeroot -- $$(FAKEROOT_SCRIPT) $$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE) - -@rm -f $$(FAKEROOT_SCRIPT) $$(FULL_DEVICE_TABLE) ifneq ($$(ROOTFS_$(2)_COMPRESS_CMD),) PATH=$$(BR_PATH) $$(ROOTFS_$(2)_COMPRESS_CMD) $$@ > $$@$$(ROOTFS_$(2)_COMPRESS_EXT) endif @@ -115,7 +111,7 @@ endif rootfs-$(1)-show-depends: @echo $$(ROOTFS_$(2)_DEPENDENCIES) -rootfs-$(1): $$(BINARIES_DIR)/rootfs.$(1) $$(ROOTFS_$(2)_POST_TARGETS) +rootfs-$(1): $$(BINARIES_DIR)/rootfs.$(1) .PHONY: rootfs-$(1) rootfs-$(1)-show-depends @@ -123,6 +119,13 @@ ifeq ($$(BR2_TARGET_ROOTFS_$(2)),y) TARGETS_ROOTFS += rootfs-$(1) PACKAGES += $$(filter-out rootfs-%,$$(ROOTFS_$(2)_DEPENDENCIES)) endif + +# Check for legacy POST_TARGETS rules +ifneq ($$(ROOTFS_$(2)_POST_TARGETS),) +$$(error Filesystem $(1) uses post-target rules, which are no longer supported.\ + Update $(1) to use post-gen hooks instead) +endif + endef define ROOTFS_TARGET diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk index e82167e512..c68e0bfb97 100644 --- a/fs/cpio/cpio.mk +++ b/fs/cpio/cpio.mk @@ -31,12 +31,13 @@ define ROOTFS_CPIO_CMD cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@ endef -$(BINARIES_DIR)/rootfs.cpio.uboot: $(BINARIES_DIR)/rootfs.cpio host-uboot-tools - $(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \ - -C none -d $<$(ROOTFS_CPIO_COMPRESS_EXT) $@ - ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y) -ROOTFS_CPIO_POST_TARGETS += $(BINARIES_DIR)/rootfs.cpio.uboot +ROOTFS_CPIO_DEPENDENCIES += host-uboot-tools +define ROOTFS_CPIO_UBOOT_MKIMAGE + $(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \ + -C none -d $@$(ROOTFS_CPIO_COMPRESS_EXT) $@.uboot +endef +ROOTFS_CPIO_POST_GEN_HOOKS += ROOTFS_CPIO_UBOOT_MKIMAGE endif $(eval $(call ROOTFS_TARGET,cpio)) diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk index 5439e2b993..12b87a722c 100644 --- a/fs/ext2/ext2.mk +++ b/fs/ext2/ext2.mk @@ -36,13 +36,11 @@ define ROOTFS_EXT2_CMD } endef -rootfs-ext2-symlink: - ln -sf rootfs.ext2$(ROOTFS_EXT2_COMPRESS_EXT) $(BINARIES_DIR)/rootfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN)$(ROOTFS_EXT2_COMPRESS_EXT) - -.PHONY: rootfs-ext2-symlink - ifneq ($(BR2_TARGET_ROOTFS_EXT2_GEN),2) -ROOTFS_EXT2_POST_TARGETS += rootfs-ext2-symlink +define ROOTFS_EXT2_SYMLINK + ln -sf rootfs.ext2$(ROOTFS_EXT2_COMPRESS_EXT) $(BINARIES_DIR)/rootfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN)$(ROOTFS_EXT2_COMPRESS_EXT) +endef +ROOTFS_EXT2_POST_GEN_HOOKS += ROOTFS_EXT2_SYMLINK endif $(eval $(call ROOTFS_TARGET,ext2)) diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk index db5081224c..b8dee18ec5 100644 --- a/fs/initramfs/initramfs.mk +++ b/fs/initramfs/initramfs.mk @@ -5,17 +5,25 @@ # ################################################################################ -ROOTFS_INITRAMFS_DEPENDENCIES += rootfs-cpio - -ROOTFS_INITRAMFS_POST_TARGETS += linux-rebuild-with-initramfs - - # The generic fs infrastructure isn't very useful here. +# +# The initramfs image does not actually build an image; its only purpose is: +# 1- to ensure rootfs.cpio is generated, +# 2- to then rebuild the kernel with rootfs.cpio as initramfs +# +# Note: ordering of the dependencies is not guaranteed here, but in +# linux/linux.mk, via the linux-rebuild-with-initramfs rule, which depends +# on the rootfs-cpio filesystem rule. +# +# Note: the trick here is that we directly depend on rebuilding the Linux +# kernel image (which itself depends on the rootfs-cpio rule), while we +# advertise that our dependency is on the rootfs-cpio rule, which is +# cleaner in the dependency graph. -rootfs-initramfs: $(ROOTFS_INITRAMFS_DEPENDENCIES) $(ROOTFS_INITRAMFS_POST_TARGETS) +rootfs-initramfs: linux-rebuild-with-initramfs rootfs-initramfs-show-depends: - @echo $(ROOTFS_INITRAMFS_DEPENDENCIES) + @echo rootfs-cpio .PHONY: rootfs-initramfs rootfs-initramfs-show-depends diff --git a/fs/iso9660/iso9660.mk b/fs/iso9660/iso9660.mk index d49d593bd6..c2de27101a 100644 --- a/fs/iso9660/iso9660.mk +++ b/fs/iso9660/iso9660.mk @@ -35,7 +35,7 @@ ROOTFS_ISO9660_USE_INITRD = YES endif ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES) -ROOTFS_ISO9660_TARGET_DIR = $(BUILD_DIR)/rootfs.iso9660.tmp +ROOTFS_ISO9660_TARGET_DIR = $(FS_DIR)/rootfs.iso9660.tmp define ROOTFS_ISO9660_CREATE_TEMPDIR $(RM) -rf $(ROOTFS_ISO9660_TARGET_DIR) mkdir -p $(ROOTFS_ISO9660_TARGET_DIR) |