filetype: add arm u-boot support
PATCH 1/2 filetype: add arm u-boot support
--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)
common/filetype.c +3 -0
@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },
@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;if (buf[9 ] ==0x016f2818 || buf[9 ] ==0x18286f01 )return filetype_arm_zimage;
include/filetype.h +1 -0
@@ -12,6 +12,7 @@ enum filetype { filetype_lzo_compressed, filetype_lz4_compressed, filetype_arm_barebox, + filetype_arm_uboot, filetype_uimage, filetype_ubi, filetype_jffs2,
Signature · 7 lines
1.8.4.rc1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 bootm: add u-boot support
Simply do the same as barebox and hope for the best as u-boot does not handle runtime address detection for boot quite often. It does only execpt you to choose as compiling time.
--- arch/arm/lib/bootm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/lib/bootm.c +13 -0
@@ -315,6 +315,12 @@ static struct image_handler barebox_handler = { .filetype = filetype_arm_barebox, }; +static struct image_handler uboot_handler = { + .name ="ARM u-boot" , + .bootm = do_bootm_barebox, + .filetype = filetype_arm_uboot, +}; +#include <aimage.h> static int aimage_load_resource (int fd,struct resource *r,void * buf,int ps)
@@ -470,9 +476,15 @@ static struct binfmt_hook binfmt_barebox_hook = { .exec = "bootm", }; +static struct binfmt_hook binfmt_uboot_hook = { + .type = filetype_arm_uboot, + .exec ="bootm" , +}; +static int armlinux_register_image_handler (void ) {register_image_handler (&barebox_handler); +register_image_handler (&uboot_handler);register_image_handler (&uimage_handler);register_image_handler (&rawimage_handler);register_image_handler (&zimage_handler);
@@ -482,6 +494,7 @@ static int armlinux_register_image_handler(void) }binfmt_register (&binfmt_arm_zimage_hook);binfmt_register (&binfmt_barebox_hook); +binfmt_register (&binfmt_uboot_hook);return 0 ; }
Signature · 7 lines
1.8.4.rc1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] bootm: add u-boot support
Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD
Simply do the same as barebox and hope for the best as u-boot does not handle runtime address detection for boot quite often. It does only execpt you to choose as compiling time.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/lib/bootm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/lib/bootm.c +0
-0
arch/arm/lib/bootm.c static struct image_handler barebox_handler = { · line 323
Quoted 9 lines
arch/arm/lib/bootm.c +6
-0@@ -315,6 +315,12 @@ static struct image_handler barebox_handler = { .filetype = filetype_arm_barebox, }; +static struct image_handler uboot_handler = { + .name ="ARM u-boot" , + .bootm = do_bootm_barebox, + .filetype = filetype_arm_uboot, +}; +
Wolfgang always emphasizes that it's not possible to start U-Boot second stage. Most U-Boot images indeed do not support this without hacking the lowlevel code. We can't support this feature which happens to work on only some U-Boot images.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] bootm: add u-boot support
Quoted 18 lines · Sascha Hauer
Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
Simply do the same as barebox and hope for the best as u-boot does not handle runtime address detection for boot quite often. It does only execpt you to choose as compiling time.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/lib/bootm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/lib/bootm.c +0
-0@@ -315,6 +315,12 @@ static struct image_handler barebox_handler = { .filetype = filetype_arm_barebox, };
Quoted 10 lines
arch/arm/lib/bootm.c static struct image_handler barebox_handler = { · line 323
Quoted 6 lines
arch/arm/lib/bootm.c +6
-0+static struct image_handler uboot_handler = { + .name ="ARM u-boot" , + .bootm = do_bootm_barebox, + .filetype = filetype_arm_uboot, +}; +Wolfgang always emphasizes that it's not possible to start U-Boot second stage. Most U-Boot images indeed do not support this without hacking the lowlevel code.
yeah they still does not understand that it's a hugely usefull feature
Quoted 2 lines
We can't support this feature which happens to work on only some U-Boot images.
that's why the comment "hope for the best"
but it's still possible on at91 and others as example
so how can we run those bianry from barebox easely
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)common/filetype.c +1
-0@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },
common/filetype.c enum filetype file_detect_type(const void *_buf, size_t bufsize) · line 231
Quoted 5 lines
common/filetype.c +2
-0@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;
0xdeadbeef is such a widely used placeholder that we should use it for filetype detection. Also, I don't think that U-Boot ever specified 0xdeadbeef at this offset as a fixed value. It could be changed without notice.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 21 lines · Sascha Hauer
Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)common/filetype.c +1
-0@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
Quoted 9 lines
common/filetype.c enum filetype file_detect_type(const void *_buf, size_t bufsize) · line 231
Quoted 4 lines
common/filetype.c +2
-0if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;
0xdeadbeefis such a widely used placeholder that we should use it for filetype detection. Also, I don't think that U-Boot ever specified0xdeadbeefat this offset as a fixed value. It could be changed without notice.
on ARM it's keeped for years > 7 IIRC
Best Regards,
J.
Quoted 8 lines
Sascha
Signature · 4 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 32 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 21 lines · Sascha Hauer
Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)common/filetype.c +1
-0@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)Quoted 9 lines
common/filetype.c enum filetype file_detect_type(const void *_buf, size_t bufsize) · line 231
Quoted 4 lines
common/filetype.c +2
-0if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;
0xdeadbeefis such a widely used placeholder that we should use it for filetype detection. Also, I don't think that U-Boot ever specified0xdeadbeefat this offset as a fixed value. It could be changed without notice.
Quoted 1 line
on ARM it's keeped for years > 7 IIRC
Yes, and there's no indication that it will change. Anyway, this was never meant as an API and everybody uses 0xdeadbeef as placeholder.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 33 lines · Sascha Hauer
Quoted 32 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 30 lines · Sascha Hauer
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)common/filetype.c +1
-0@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },common/filetype.c enum filetype file_detect_type(const void *_buf, size_t bufsize) · line 231
Quoted 5 lines
common/filetype.c +2
-0@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;
0xdeadbeefis such a widely used placeholder that we should use it for filetype detection. Also, I don't think that U-Boot ever specified0xdeadbeefat this offset as a fixed value. It could be changed without notice.
Quoted 4 lines
Quoted 1 line
on ARM it's keeped for years > 7 IIRC
Yes, and there's no indication that it will change. Anyway, this was never meant as an API and everybody uses
0xdeadbeefas placeholder.
so the question remain how to boot a u-boot that can be a second stage
Best Regards,
J.
Quoted 8 lines
Sascha
Signature · 4 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 34 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 33 lines · Sascha Hauer
Quoted 32 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 30 lines · Sascha Hauer
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)common/filetype.c +1
-0@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },common/filetype.c enum filetype file_detect_type(const void *_buf, size_t bufsize) · line 231
Quoted 5 lines
common/filetype.c +2
-0@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;
0xdeadbeefis such a widely used placeholder that we should use it for filetype detection. Also, I don't think that U-Boot ever specified0xdeadbeefat this offset as a fixed value. It could be changed without notice.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
on ARM it's keeped for years > 7 IIRC
Yes, and there's no indication that it will change. Anyway, this was never meant as an API and everybody uses
0xdeadbeefas placeholder.so the question remain how to boot a u-boot that can be a second stage
'go'? You could also embed it in an uImage if you really want to use the bootm command.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 37 lines · Sascha Hauer
Quoted 36 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 35 lines · Sascha Hauer
Quoted 33 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 21 lines · Sascha Hauer
Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)common/filetype.c +1
-0@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)Quoted 9 lines
common/filetype.c enum filetype file_detect_type(const void *_buf, size_t bufsize) · line 231
Quoted 4 lines
common/filetype.c +2
-0if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;
0xdeadbeefis such a widely used placeholder that we should use it for filetype detection. Also, I don't think that U-Boot ever specified0xdeadbeefat this offset as a fixed value. It could be changed without notice.on ARM it's keeped for years > 7 IIRC
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Yes, and there's no indication that it will change. Anyway, this was never meant as an API and everybody uses
0xdeadbeefas placeholder.so the question remain how to boot a u-boot that can be a second stage
'go'? You could also embed it in an uImage if you really want to use the bootm command.
I really hate the go you need to load in ram and then do the go
Best Regards,
J.
Quoted 9 lines
Sascha
Signature · 4 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 41 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 40 lines · Sascha Hauer
Quoted 39 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 37 lines · Sascha Hauer
Quoted 32 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 21 lines · Sascha Hauer
Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)common/filetype.c +1
-0@@ -35,6 +35,7 @@ static const struct filetype_str filetype_str[] = { [filetype_lzo_compressed] = { "lzo compressed", "lzo" }, [filetype_lz4_compressed] = { "lz4 compressed", "lz4" }, [filetype_arm_barebox] = { "arm barebox image", "arm-barebox" }, + [filetype_arm_uboot] = { "arm u-boot image", "arm-u-boot" }, [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" },@@ -226,6 +227,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)Quoted 9 lines
common/filetype.c enum filetype file_detect_type(const void *_buf, size_t bufsize) · line 231
Quoted 4 lines
common/filetype.c +2
-0if (is_barebox_arm_head (_buf))return filetype_arm_barebox; +if (buf[15 ] ==0xdeadbeef ) +return filetype_arm_uboot;
0xdeadbeefis such a widely used placeholder that we should use it for filetype detection. Also, I don't think that U-Boot ever specified0xdeadbeefat this offset as a fixed value. It could be changed without notice.Quoted 1 line
on ARM it's keeped for years > 7 IIRC
Yes, and there's no indication that it will change. Anyway, this was never meant as an API and everybody uses
0xdeadbeefas placeholder.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
so the question remain how to boot a u-boot that can be a second stage
'go'? You could also embed it in an uImage if you really want to use the bootm command.
I really hate the go you need to load in ram and then do the go
You could also use the -f option to bootm instead.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox