From: Sascha Hauer <s.hauer@pengutronix.de>
To: Christoph Fritz <chf.fritz@googlemail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] ARM OMAP: MLO: add support for loading Barebox from UBI
Date: Tue, 25 Jun 2013 06:22:58 +0200 [thread overview]
Message-ID: <20130625042258.GF14308@pengutronix.de> (raw)
In-Reply-To: <1371808521.3949.14.camel@mars>
Hi Christoph,
On Fri, Jun 21, 2013 at 11:55:21AM +0200, Christoph Fritz wrote:
> This patch adds support to OMAP MLO to load a secound
> stage bootloader from a static UBI volume.
>
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> ---
> arch/arm/mach-omap/Kconfig | 44 +++++++++++++++++++++++++
> arch/arm/mach-omap/xload.c | 76 ++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 118 insertions(+), 2 deletions(-)
>
> +static void *omap_xload_boot_ubi_nand(void)
> +{
> + void *to = NULL;
> +#ifdef CONFIG_BB_IN_UBI
You shouldn't need this ifdef
> + void *header;
> + int ret;
> + struct cdev *cdev;
> + struct mtd_info_user user;
> + int size;
> +
> + devfs_add_partition("nand0", CONFIG_BB_IN_UBI_PARTITION_START,
> + CONFIG_BB_IN_UBI_PARTITION_SIZE, DEVFS_PARTITION_FIXED, "u");
I don't like putting these in kconfig. Ideally these should be passed by
the board code.
> +
> + cdev = cdev_open(CONFIG_BB_IN_UBI_VOLNAME, O_RDONLY);
> + if (!cdev) {
> + printf("cdev_open failed\n");
Such error messages should always print the return value if possible.
> + return NULL;
> + }
> +
> + if (cdev_read(cdev, to, size, 0, 0) < 0) {
> + printf("cdev_read failed\n");
ditto.
> + cdev_close(cdev);
> + return NULL;
> + }
> +
> + cdev_close(cdev);
> +
> +#endif
> + return to;
> +}
> +
> static void *omap_xload_boot_mmc(void)
> {
> int ret;
> @@ -180,8 +247,13 @@ static __noreturn int omap_xload(void)
> printf("booting from USB not enabled\n");
> }
> case BOOTSOURCE_NAND:
> - printf("booting from NAND\n");
> - func = omap_xload_boot_nand(SZ_128K);
> + if (IS_ENABLED(CONFIG_BB_IN_UBI)) {
> + printf("booting from UBI static volume\n");
> + func = omap_xload_boot_ubi_nand();
You could check for filetype_ubi here instead of making this a
compiletime decision.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-06-25 4:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-21 9:53 [PATCH 0/2] OMAP: Boot " Christoph Fritz
2013-06-21 9:55 ` [PATCH 1/2] ARM OMAP: MLO: add support for loading Barebox " Christoph Fritz
2013-06-25 4:22 ` Sascha Hauer [this message]
2013-06-21 9:55 ` [PATCH 2/2] ARM OMAP: add support for loading Environment " Christoph Fritz
2013-06-25 5:26 ` Sascha Hauer
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=20130625042258.GF14308@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=chf.fritz@googlemail.com \
/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