From patchwork Wed Nov 6 23:12:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 289062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 537AD2C00A9 for ; Thu, 7 Nov 2013 10:14:45 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 82FC28D6AA; Wed, 6 Nov 2013 23:14:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AUuLCQIn-KVa; Wed, 6 Nov 2013 23:14:40 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 63B828D654; Wed, 6 Nov 2013 23:14:39 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 7089D1BF976 for ; Wed, 6 Nov 2013 23:14:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6A5D08D648 for ; Wed, 6 Nov 2013 23:14:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b9pyGHahRxn6 for ; Wed, 6 Nov 2013 23:14:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from viper.mind.be (132.79-246-81.adsl-static.isp.belgacom.be [81.246.79.132]) by whitealder.osuosl.org (Postfix) with ESMTPS id E02A58D65A for ; Wed, 6 Nov 2013 23:14:36 +0000 (UTC) Received: from [172.16.2.6] (helo=vandecaa-laptop) by viper.mind.be with esmtp (Exim 4.69) (envelope-from ) id 1VeCIT-0001ST-Co; Thu, 07 Nov 2013 00:14:01 +0100 Received: from arnout by vandecaa-laptop with local (Exim 4.80) (envelope-from ) id 1VeCJ0-0004Ls-GS; Thu, 07 Nov 2013 00:14:34 +0100 From: "Arnout Vandecappelle (Essensium/Mind)" To: buildroot@busybox.net Date: Thu, 7 Nov 2013 00:12:34 +0100 Message-Id: <1383779555-9222-7-git-send-email-arnout@mind.be> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1383779555-9222-1-git-send-email-arnout@mind.be> References: <1383779555-9222-1-git-send-email-arnout@mind.be> Subject: [Buildroot] [PATCH 6/7] rootfs-cpio: add U-Boot image support X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net 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 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- v2: patch taken over by Arnout - Rewrote help text. - Moved implementation to cpio.mk, because it will be the only one to ever use it. - Implement as a post-target instead of post-hook. - Removed compression type flag. It is not very useful to let U-Boot do decompression, especially because not all U-Boot configs support all possible decompression methods. - Reordered the Config.in options. - use correct -A flag Since almost no lines are still the same as in the original patch, I've claimed full authorship - sorry Spenser :-) Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- fs/cpio/Config.in | 13 ++++++++++++- fs/cpio/cpio.mk | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/fs/cpio/Config.in b/fs/cpio/Config.in index fd85d29..206baca 100644 --- a/fs/cpio/Config.in +++ b/fs/cpio/Config.in @@ -5,10 +5,11 @@ config BR2_TARGET_ROOTFS_CPIO used for an initial RAM filesystem that is passed to the kernel by the bootloader. +if BR2_TARGET_ROOTFS_CPIO + choice prompt "Compression method" default BR2_TARGET_ROOTFS_CPIO_NONE - depends on BR2_TARGET_ROOTFS_CPIO help Select compressor for cpio filesystem of the root filesystem. If you use the cpio archive as an initial RAM filesystem, make @@ -47,3 +48,13 @@ config BR2_TARGET_ROOTFS_CPIO_XZ 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 diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk index 0df2378..e39e215 100644 --- a/fs/cpio/cpio.mk +++ b/fs/cpio/cpio.mk @@ -31,4 +31,25 @@ define ROOTFS_CPIO_CMD cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@ 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))