diff mbox

[1/1] fs/romfs: add U-Boot image support

Message ID 1433782196-17824-1-git-send-email-hoang.tran@vnoss.org
State Rejected
Headers show

Commit Message

Hoang Tran June 8, 2015, 4:49 p.m. UTC
Adds U-Boot image support for romfs root filesystems. This allows you to
use the bootm command in U-Boot to load the rootfs.

Signed-off-by: Hoang Tran <hoang.tran@vnoss.org>
---
 fs/romfs/Config.in | 13 +++++++++++++
 fs/romfs/romfs.mk  | 10 +++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

Comments

Arnout Vandecappelle June 8, 2015, 8:28 p.m. UTC | #1
On 06/08/15 18:49, Hoang Tran wrote:
> Adds U-Boot image support for romfs root filesystems. This allows you to
> use the bootm command in U-Boot to load the rootfs.

 Why would you want to do that? I don't see any reason to use the old
block-device-initrd rather than the usual cpio-initramfs...


 Regards,
 Arnout

> 
> Signed-off-by: Hoang Tran <hoang.tran@vnoss.org>
[snip]
Thomas Petazzoni June 14, 2015, 9:29 p.m. UTC | #2
Dear Hoang Tran,

On Mon,  8 Jun 2015 09:49:56 -0700, Hoang Tran wrote:
> Adds U-Boot image support for romfs root filesystems. This allows you to
> use the bootm command in U-Boot to load the rootfs.
> 
> Signed-off-by: Hoang Tran <hoang.tran@vnoss.org>
> ---
>  fs/romfs/Config.in | 13 +++++++++++++
>  fs/romfs/romfs.mk  | 10 +++++++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)

Considering the absence of reaction to Arnout's comment about your
patch, I've marked it as 'Rejected' in our patch tracking system. Of
course, if you believe the patch is still useful despite Arnout
comment, do not hesitate to resend an updated version with an extended
justification.

Thanks,

Thomas
Hoang Tran June 15, 2015, 2:46 p.m. UTC | #3
> > Adds U-Boot image support for romfs root filesystems. This allows you to
> > use the bootm command in U-Boot to load the rootfs.
> >
> > Signed-off-by: Hoang Tran <hoang.tran@vnoss.org>
> > ---
> >  fs/romfs/Config.in | 13 +++++++++++++
> >  fs/romfs/romfs.mk  | 10 +++++++++-
> >  2 files changed, 22 insertions(+), 1 deletion(-)
>
> Considering the absence of reaction to Arnout's comment about your
> patch, I've marked it as 'Rejected' in our patch tracking system. Of
> course, if you believe the patch is still useful despite Arnout
> comment, do not hesitate to resend an updated version with an extended
> justification.

Dear Thomas, Arnout,

Sorry I did not response because of the problem of my email client.
But anyway I agree with Arnout.
My rootfs is in romfs and I intended to make a uRamdisk for quick testing.
But we could use cpio Ramdisk instead.

Regards,
Hoang
Thomas Petazzoni June 15, 2015, 2:51 p.m. UTC | #4
Dear Hoang Tran,

On Mon, 15 Jun 2015 10:46:08 -0400, Hoang Tran wrote:

> Sorry I did not response because of the problem of my email client.
> But anyway I agree with Arnout.
> My rootfs is in romfs and I intended to make a uRamdisk for quick testing.
> But we could use cpio Ramdisk instead.

a "uRamdisk" can be in cpio format. Basically the "u" is just a
container for a ramdisk, and the ramdisk itself can use the cpio
format, or ext2, or whatever filesystem you want. However, by using
cpio, you leverage the initramfs mechanism of the kernel, which is much
better than initrd in terms of memory consumption.

See:

  https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt

Best regards,

Thomas
Hoang Tran June 15, 2015, 2:59 p.m. UTC | #5
On Mon, Jun 15, 2015 at 10:51 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Hoang Tran,
>
> On Mon, 15 Jun 2015 10:46:08 -0400, Hoang Tran wrote:
>
>> Sorry I did not response because of the problem of my email client.
>> But anyway I agree with Arnout.
>> My rootfs is in romfs and I intended to make a uRamdisk for quick testing.
>> But we could use cpio Ramdisk instead.
>
> a "uRamdisk" can be in cpio format. Basically the "u" is just a
> container for a ramdisk, and the ramdisk itself can use the cpio
> format, or ext2, or whatever filesystem you want. However, by using
> cpio, you leverage the initramfs mechanism of the kernel, which is much
> better than initrd in terms of memory consumption.
>
> See:
>
>   https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt
>

I get it. That is really useful. Thank you.

Hoang
diff mbox

Patch

diff --git a/fs/romfs/Config.in b/fs/romfs/Config.in
index 84944a0..34faf2d 100644
--- a/fs/romfs/Config.in
+++ b/fs/romfs/Config.in
@@ -2,3 +2,16 @@  config BR2_TARGET_ROOTFS_ROMFS
 	bool "romfs root filesystem"
 	help
 	  Build a romfs image of the root filesystem.
+
+if BR2_TARGET_ROOTFS_ROMFS
+
+config BR2_TARGET_ROOTFS_ROMFS_UIMAGE
+	bool "u-boot image of romfs root filesystem"
+	select BR2_PACKAGE_HOST_UBOOT_TOOLS
+	help
+	  Add a u-boot header to the romfs root filesystem. This allows
+	  the u-boot image to be loaded with the bootm command in U-Boot.
+
+	  The u-boot image will be called rootfs.romfs.uboot
+
+endif
diff --git a/fs/romfs/romfs.mk b/fs/romfs/romfs.mk
index e0ac65f..9fa5005 100644
--- a/fs/romfs/romfs.mk
+++ b/fs/romfs/romfs.mk
@@ -12,4 +12,12 @@  define ROOTFS_ROMFS_CMD
 	$(HOST_DIR)/usr/bin/genromfs -d $(TARGET_DIR) -f $@
 endef
 
-$(eval $(call ROOTFS_TARGET,romfs))
\ No newline at end of file
+$(BINARIES_DIR)/rootfs.romfs.uboot: $(BINARIES_DIR)/rootfs.romfs host-uboot-tools
+	$(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk -O linux \
+		-C none -d $<$(ROOTFS_ROMFS_COMPRESS_EXT) $@
+
+ifeq ($(BR2_TARGET_ROOTFS_ROMFS_UIMAGE),y)
+ROOTFS_ROMFS_POST_TARGETS += $(BINARIES_DIR)/rootfs.romfs.uboot
+endif
+
+$(eval $(call ROOTFS_TARGET,romfs))