rootfs-cpio: add U-Boot image support

Adds U-Boot image support for cpio root filesystems. This allows you to
use the bootm command in U-Boot to load the rootfs. It makes it possible to
verify the CRC of the initramfs before booting the kernel.

[Spenser: wrote first version of the patch.]
Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Arnout Vandecappelle 2013-11-07 00:12:34 +01:00 committed by Peter Korsgaard
parent 4df9ecb30a
commit 3970ebf837
2 changed files with 33 additions and 1 deletions

View File

@ -5,10 +5,11 @@ config BR2_TARGET_ROOTFS_CPIO
used for an initial RAM filesystem that is passed to the kernel used for an initial RAM filesystem that is passed to the kernel
by the bootloader. by the bootloader.
if BR2_TARGET_ROOTFS_CPIO
choice choice
prompt "Compression method" prompt "Compression method"
default BR2_TARGET_ROOTFS_CPIO_NONE default BR2_TARGET_ROOTFS_CPIO_NONE
depends on BR2_TARGET_ROOTFS_CPIO
help help
Select compressor for cpio filesystem of the root filesystem. Select compressor for cpio filesystem of the root filesystem.
If you use the cpio archive as an initial RAM filesystem, make If you use the cpio archive as an initial RAM filesystem, make
@ -47,3 +48,13 @@ config BR2_TARGET_ROOTFS_CPIO_XZ
endchoice endchoice
config BR2_TARGET_ROOTFS_CPIO_UIMAGE
bool "Create U-Boot image of the root filesystem"
select BR2_PACKAGE_HOST_UBOOT_TOOLS
help
Add a U-Boot header to the cpio root filesystem. This allows
the initramfs to be loaded with the bootm command in U-Boot.
The U-Boot image will be called rootfs.cpio.uboot
endif # BR2_TARGET_ROOTFS_CPIO

View File

@ -31,4 +31,25 @@ define ROOTFS_CPIO_CMD
cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@ cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
endef endef
# mkimage supports arm avr32 blackfin m68k microblaze mips mips64 nios2 powerpc ppc sh sparc sparc64 x86
# KERNEL_ARCH can be arm64 arc arm avr32 blackfin m68k microblaze mips nios2 powerpc sh sparc i386 x86_64 xtensa
# For arm64, arc, xtensa we'll just keep KERNEL_ARCH
# For mips64, we'll just keep mips
# For i386 and x86_64, we need to convert
ifeq ($(KERNEL_ARCH),x86_64)
UIMAGE_ARCH = x86
else ifeq ($(KERNEL_ARCH),i386)
UIMAGE_ARCH = x86
else
UIMAGE_ARCH = $(KERNEL_ARCH)
endif
$(BINARIES_DIR)/rootfs.cpio.uboot: $(BINARIES_DIR)/rootfs.cpio host-uboot-tools
$(HOST_DIR)/usr/bin/mkimage -A $(UIMAGE_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
endif
$(eval $(call ROOTFS_TARGET,cpio)) $(eval $(call ROOTFS_TARGET,cpio))