Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] fs/ubi: add option to use custom volume config file
Date: Sun, 15 Sep 2013 20:53:10 +0200	[thread overview]
Message-ID: <20130915205310.06f8af50@skate> (raw)
In-Reply-To: <CANxTyt4GZNTtACwf4W8OCKUBZLf7YfZ=pBM-6KGmgeaf8UCPLg@mail.gmail.com>

Dear Danomi Manchego,

On Sun, 15 Sep 2013 14:37:21 -0400, Danomi Manchego wrote:

> > However, I'd like to add more detail on using the rootfs UBIFS
> > image in a volume (i.e $@fs in the existing code), but I'm not sure
> > what suggestion to give to the user: i.e, what image= line should
> > he put in his custom configuration file?
> 
> What I found was that the image path is relative to the $(TOPDIR).  So
> if you are providing your own file, you need to know your $(O) and
> either specify a path relative to $(TOPDIR), or an absolute path.  i
> played with the idea of having a sed line or something to substitute
> in a file path, but decided against.  I though that if you are
> providing your own config file, then it could refer to multiple images
> in different output directories (for whatever reason), in which case
> you have to know where your files are anyway.

Using sed sounds like a good idea. Just provide a keyword that the user
can use in his custom configuration file, and that Buildroot will
automatically replace by the path to the UBIFS root filesystem image.
Of course, for the other volumes, the user can specify whichever image
he wants.

So, the user could write something like:

[rootfs]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_flags=autoresize
image=BR2_ROOTFS_UBIFS_PATH

[datafs]
mode=ubi
vol_id=1
vol_type=dynamic
vol_name=datafs
vol_alignment=1
vol_flags=autoresize
image=/some/other/location.img

and Buildroot replaces BR2_ROOTFS_UBIFS_PATH by the proper
$(O)/images/ubifs.img.

Note that this could also be used in the fs/ubifs/ubinize.cfg file,
therefore making the default and custom cases more similar:

ifeq ($(BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG),y)
UBINIZE_CONFIG_FILE_PATH = $(call qstrip,$(BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE))
else
UBINIZE_CONFIG_FILE_PATH = fs/ubifs/ubinize.cfg
endef

define ROOTFS_UBI_CMD
	cp $(UBINIZE_CONFIG_FILE_PATH) $(BUILD_DIR)/ubinize.cfg
	$(SED) 's/BR2_ROOTFS_UBIFS_PATH/$@fs/' $(BUILD_DIR)/ubinize.cfg
	$(HOST_DIR)/usr/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg
	rm $(BUILD_DIR)/ubinize.cfg
endef

Of course, the BR2_ROOTFS_UBIFS_PATH trick would have to be properly
documented in the configuration option help text.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2013-09-15 18:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-15  3:21 [Buildroot] [PATCH] fs/ubi: add option to use custom volume config file Danomi Manchego
2013-09-15  4:38 ` Baruch Siach
2013-09-15 13:06   ` Danomi Manchego
2013-09-15 18:00 ` Thomas Petazzoni
2013-09-15 18:37   ` Danomi Manchego
2013-09-15 18:53     ` Thomas Petazzoni [this message]
2013-09-15 19:08       ` Danomi Manchego
2013-09-15 19:16         ` Thomas Petazzoni
2014-01-27 23:17           ` Ezequiel García
2014-01-27 23:57             ` Danomi Manchego
2014-01-28 16:35             ` Thomas Petazzoni
2014-01-28 16:59               ` Ezequiel García
2014-01-28 18:22             ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130915205310.06f8af50@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox