[U-Boot] [PATCH v2 01/11] arm: Optionally use existing atags in bootm.c

Pali Rohár
2012-06-01T18:31:49Z

On Sunday 29 April 2012 15:08:00 you wrote:
> Dear Pali Roh?r,
>
> > On Sunday 29 April 2012 11:10:42 Marek Vasut wrote:
> > > Dear Pali Roh?r,
> > >
> > > > On Sunday 29 April 2012 00:15:23 Marek Vasut wrote:
> > > > > Won't it be easier to create a preprocessing function
> > > > > that'd
> > > > > fill gd properly, so uboot can generate the atags
> > > > > through
> > > > > standard means then?
> > > >
> > > > Do you mean to generate/copy other atags in board code?
> > > > This
> > > > will not work because u-boot (in bootm.c) always passing
> > > > ATAG_CORE in function setup_start_tag. And I do not want
> > > > to
> > > > pass ATAG_CORE two times to kernel (once which I copy
> > > > from
> > > > other bootloader and once which generate u-boot).
> > >
> > > No, I mean parse the old ATAGS from nolo and fill u-boot's
> > > internal structures with that. Then let uboot generate the
> > > ATAGS from it's internal structures as usual.
> > >
> > > Best regards,
> > > Marek Vasut
> >
> > Ok, but what to do with non-standard omap/maemo atags which
> > is
> > used only for maemo (atag for bootreason, atag for bootmode
> > ...)? U-Boot does not have internal structures for these
> > non-standrad atags and also does not support passing it.
>
> Implement support for passing ad-hoc additional non-standard
> atags then?
>
> Best regards,
> Marek Vasut

Hi, what do you think about adding function setup_board_tags
which will be implemented in board code?

diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index 89df4dc..572cb2a 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -267,3 +267,10 @@ struct meminfo {
extern struct meminfo meminfo;

#endif
+
+/*
+ * Board specified tags
+ */
+#ifdef CONFIG_SETUP_BOARD_TAGS
+void setup_board_tags(struct tag **in_params);
+#endif
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 599547d..9c27405 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -111,6 +111,15 @@ static void announce_and_cleanup(void)
defined(CONFIG_INITRD_TAG) || \
defined(CONFIG_SERIAL_TAG) || \
defined(CONFIG_REVISION_TAG)
+#ifndef CONFIG_ATAG_CORE_FLAGS
+#define CONFIG_ATAG_CORE_FLAGS 0
+#endif
+#ifndef CONFIG_ATAG_CORE_PAGESIZE
+#define CONFIG_ATAG_CORE_PAGESIZE 0
+#endif
+#ifndef CONFIG_ATAG_CORE_ROOTDEV
+#define CONFIG_ATAG_CORE_ROOTDEV 0
+#endif
static void setup_start_tag (bd_t *bd)
{
params = (struct tag *)bd->bi_boot_params;
@@ -118,9 +127,9 @@ static void setup_start_tag (bd_t *bd)
params->hdr.tag = ATAG_CORE;
params->hdr.size = tag_size (tag_core);

- params->u.core.flags = 0;
- params->u.core.pagesize = 0;
- params->u.core.rootdev = 0;
+ params->u.core.flags = CONFIG_ATAG_CORE_FLAGS;
+ params->u.core.pagesize = CONFIG_ATAG_CORE_PAGESIZE;
+ params->u.core.rootdev = CONFIG_ATAG_CORE_ROOTDEV;

params = tag_next (params);
}
@@ -304,6 +313,9 @@ static void boot_prep_linux(bootm_headers_t *images)
setup_initrd_tag(gd->bd, images->rd_start,
images->rd_end);
#endif
+#ifdef CONFIG_SETUP_BOARD_TAGS
+ setup_board_tags(&params);
+#endif
setup_end_tag(gd->bd);
#else /* all tags */
printf("FDT and ATAGS support not compiled in - hanging\n");

--
Pali Roh?r
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120601/b5ba772a/attachment.pgp>