Skip to contentSkip to conversation

fs/romfs: add U-Boot image support

PATCH New Hoang Tran 3 participants 6 messages Jun 8, 2015 – Jun 15, 2015

lore
Share & tools
lore

Hoang Tran

author
#0 lore raw

PATCH 1/1 fs/romfs: add U-Boot image support

Adds U-Boot image support for romfs root filesystems. This allows you to use the bootm command in U-Boot to load the rootfs.

---
 fs/romfs/Config.in | 13 +++++++++++++
 fs/romfs/romfs.mk  | 10 +++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
fs/romfs/Config.in +13 -0
index 84944a0..34faf2d 100644
@@ -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
fs/romfs/romfs.mk +9 -1
index e0ac65f..9fa5005 100644
@@ -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))
Signature · 1 line
2.3.5
#1 lore raw

PATCH 1/1 fs/romfs: add U-Boot image support

Quoted 2 lines · Hoang Tran

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

Quoted 2 lines

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 fs/romfs: add U-Boot image support

In reply to Hoang Tran

Dear Hoang Tran,

Quoted 8 lines · Hoang Tran

Adds U-Boot image support for romfs root filesystems. This allows you to use the bootm command in U-Boot to load the rootfs.

---
 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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#3 lore raw

PATCH 1/1 fs/romfs: add U-Boot image support

Quoted 9 lines
Quoted 8 lines

Adds U-Boot image support for romfs root filesystems. This allows you to use the bootm command in U-Boot to load the rootfs.

---
 fs/romfs/Config.in | 13 +++++++++++++
 fs/romfs/romfs.mk  | 10 +++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
Quoted 5 lines

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

#4 lore raw

PATCH 1/1 fs/romfs: add U-Boot image support

Dear Hoang Tran,

Quoted 4 lines · Hoang Tran

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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#5 lore raw

PATCH 1/1 fs/romfs: add U-Boot image support

Quoted 15 lines · Thomas Petazzoni

Dear Hoang Tran,

Quoted 4 lines · Hoang Tran

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.

Quoted 4 lines

See:

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

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

Hoang