Android and arm64 improvement
cover Android and arm64 improvement
I rebased the two patches submitted (quite )a while ago on top of current U-boot master fb4413295c765aa8c013650984dc2d908964c81d (and there were no conflicts).
The first patch added the support of parsing the second area of Android image so that it can be used for good. On Poplar board, we are using that area for dtb. The first patch shouldn't impact any functionality since
it is new.
The second patch moves the booti_setup out of booti.c. It was the result of a discusion[1] how to better support the arm64 Android image.
I have boot tested it on Poplar board[2] with additional patch[3] that is built on top of the booti. I have hacked version of using bootm but it seems quit mess up - need lots of changes in different places ("Shotgun Surgery") to handle Android specific and/or arm64 specific code. Now, I feel a separate bootandroid command might be a cleaner solution.
That being said, the second patch doesn't depend on or impact any change we might have in the future for better Android support.
[1] https://lists.denx.de/pipermail/u-boot/2017-July/297933.html
[2] https://github.com/96boards-poplar/Documentation
[3] https://github.com/pierrchen/u-boot/commit/8463e6177654026746161487d0f0bd8998bb7a5b
Bin Chen (2):
parse the second area of android image
move booti_setup to arch/arm/lig/image.c
arch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 +++++++++++++++++++++++++++++++++++++++++ cmd/booti.c | 92 +++++++------------------------------------------- common/image-android.c | 19 +++++++++++ include/image.h | 11 ++++++ 5 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.c
Signature · 1 line
2.15.0
PATCH 1/2 parse the second area of android image
The second area of android image was intended to put a 2nd stage bootloader but in practice were rarely used (in my knowledge).
An proposal was made to the AOSP to (re)use the second area as the dtb[1], This patch itself doesn't depend on that proposal being accepted but it won't be that helpful as well if that proposal won't be accepted. But don't do any harm as well.
[1] https://android-review.googlesource.com/#/c/417447/
--- common/image-android.c | 19 +++++++++++++++++++ include/image.h | 2 ++ 2 files changed, 21 insertions(+)
common/image-android.c +19 -0
@@ -146,6 +146,25 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,return 0 ; } +int android_image_get_second (const struct andr_img_hdr *hdr, +ulong *second_data,ulong *second_len) +{ +if (!hdr->second_size) { + *second_data = *second_len =0 ; +return -1 ; + } + + *second_data = (unsigned long )hdr; + *second_data += hdr->page_size; + *second_data +=ALIGN (hdr->kernel_size, hdr->page_size); + *second_data +=ALIGN (hdr->ramdisk_size, hdr->page_size); + +printf ("second address is 0x%lx\n" ,*second_data); + + *second_len = hdr->second_size; +return 0 ; +} +#if !defined(CONFIG_SPL_BUILD )/** * android_print_contents - prints out the contents of the Android format image
include/image.h +2 -0
@@ -1263,6 +1263,8 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, ulong *os_data, ulong *os_len);int android_image_get_ramdisk (const struct andr_img_hdr *hdr,ulong *rd_data,ulong *rd_len); +int android_image_get_second (const struct andr_img_hdr *hdr, +ulong *second_data,ulong *second_len);ulong android_image_get_end (const struct andr_img_hdr *hdr);ulong android_image_get_kload (const struct andr_img_hdr *hdr);void android_print_contents (const struct andr_img_hdr *hdr);
Signature · 1 line
2.15.0
PATCH 1/2 parse the second area of android image
Quoted 11 lines · Bin Chen
The second area of android image was intended to put a 2nd stage bootloader but in practice were rarely used (in my knowledge).
An proposal was made to the AOSP to (re)use the second area as the dtb[1], This patch itself doesn't depend on that proposal being accepted but it won't be that helpful as well if that proposal won't be accepted. But don't do any harm as well.
[1] https://android-review.googlesource.com/#/c/417447/
Signed-off-by Bin Chen <[email protected]>Reviewed-by Tom Rini <[email protected]>
Looks good to me,
Thanks,
- Kever
Quoted 48 lines
--- common/image-android.c | 19 +++++++++++++++++++ include/image.h | 2 ++ 2 files changed, 21 insertions(+)common/image-android.c +19
-0@@ -146,6 +146,25 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,return 0 ; } +int android_image_get_second (const struct andr_img_hdr *hdr, +ulong *second_data,ulong *second_len) +{ +if (!hdr->second_size) { + *second_data = *second_len =0 ; +return -1 ; + } + + *second_data = (unsigned long )hdr; + *second_data += hdr->page_size; + *second_data +=ALIGN (hdr->kernel_size, hdr->page_size); + *second_data +=ALIGN (hdr->ramdisk_size, hdr->page_size); + +printf ("second address is 0x%lx\n" ,*second_data); + + *second_len = hdr->second_size; +return 0 ; +} +#if !defined(CONFIG_SPL_BUILD )/** * android_print_contents - prints out the contents of the Android format image include/image.h +2
-0@@ -1263,6 +1263,8 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, ulong *os_data, ulong *os_len);int android_image_get_ramdisk (const struct andr_img_hdr *hdr,ulong *rd_data,ulong *rd_len); +int android_image_get_second (const struct andr_img_hdr *hdr, +ulong *second_data,ulong *second_len);ulong android_image_get_end (const struct andr_img_hdr *hdr);ulong android_image_get_kload (const struct andr_img_hdr *hdr);void android_print_contents (const struct andr_img_hdr *hdr);
PATCH 1/2 parse the second area of android image
In reply to Bin ChenQuoted 8 lines · Bin Chen
The second area of android image was intended to put a 2nd stage bootloader but in practice were rarely used (in my knowledge).
An proposal was made to the AOSP to (re)use the second area as the dtb[1], This patch itself doesn't depend on that proposal being accepted but it won't be that helpful as well if that proposal won't be accepted. But don't do any harm as well.
Quoted 4 lines
[1] https://android-review.googlesource.com/#/c/417447/
Signed-off-by Bin Chen <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Kever Yang <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180208/0e43169e/attachment.sig>
PATCH 2/2 move booti_setup to arch/arm/lig/image.c
In reply to Bin ChenFollow bootz's pattern by moving the booti_setup to arch/arm/lib. This allows to use booti_setup in other paths, e.g booting an Android image containing Image format.
Note that kernel relocation is move out of booti_setup and it is the caller's responsibility to do it and allows them do it differently. say, cmd/booti.c just do a manually, while in the bootm path, we can use bootm_load_os(with some changes).
v2:
- fix review comments for indentation
- fix the comment for booti_setup
- rebase to lastest u-boot
- improve the commit comment
--- arch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 ++++++++++++++++++++++++++++++++++++++++++ cmd/booti.c | 92 ++++++++------------------------------------------- include/image.h | 9 +++++ 4 files changed, 99 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.c
arch/arm/lib/Makefile +1 -1
@@ -32,7 +32,7 @@ endif obj-$(CONFIG_CPU_V7M) += cmd_boot.o obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o -obj-$(CONFIG_CMD_BOOTI) += bootm.o +obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
arch/arm/lib/image.c new file +76 -0
76 lines not on this page · raw message
cmd/booti.c +13 -79
121 lines not on this page · raw message
include/image.h +9 -0
@@ -871,6 +871,15 @@ int image_setup_linux(bootm_headers_t *images);*/ int bootz_setup (ulong image,ulong *start,ulong *end); +/** +* Return the correct start address and size of a Linux aarch64 Image. +* +* @image: Address of image +* @start: Returns start address of image +* @size : Returns size image +* @return 0 if OK, 1 if the image was not recognised +*/ +int booti_setup (ulong image,ulong *relocated_addr,ulong *size);/*******************************************************************/ /* New uImage format specific code (prefixed with fit_) */
Signature · 1 line
2.15.0
PATCH 2/2 move booti_setup to arch/arm/lig/image.c
Quoted 9 lines · Bin Chen
Follow bootz's pattern by moving the
booti_setuptoarch/arm/lib. This allows to usebooti_setupin other paths, e.g booting an Android image containing Image format.Note that kernel relocation is move out of
booti_setupand it is the caller's responsibility to do it and allows them do it differently. say,cmd/booti.cjust do a manually, while in the bootm path, we can usebootm_load_os(with some changes).
Quoted 8 lines
v2:
- fix review comments for indentation
- fix the comment forbooti_setup
- rebase to lastest u-boot
- improve the commit commentSigned-off-by Bin Chen <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180208/5d987a45/attachment.sig>
cover Android and arm64 improvement
In reply to Bin ChenHello Tom,
Any feedback on this?
Quoted 49 lines · Bin Chen
I rebased the two patches submitted (quite )a while ago on top of current U-boot master
fb4413295c765aa8c013650984dc2d908964c81d(and there were no conflicts).The first patch added the support of parsing the second area of Android image so
that it can be used for good. On Poplar board, we are using that area for dtb.
The first patch shouldn't impact any functionality since
it is new.The second patch moves the
booti_setupout ofbooti.c. It was the result of a
discusion[1] how to better support the arm64 Android image.I have boot tested it on Poplar board[2] with additional patch[3] that is built on top of the booti. I have hacked version of using bootm but it seems quit
mess up - need lots of changes in different places ("Shotgun Surgery") to handle
Android specific and/or arm64 specific code. Now, I feel a separate bootandroid command might be a cleaner solution.That being said, the second patch doesn't depend on or impact any change we might have in the future for better Android support.
[1] https://lists.denx.de/pipermail/u-boot/2017-July/297933.html
[2] https://github.com/96boards-poplar/Documentation
[3] https://github.com/pierrchen/u-boot/commit/8463e6177654026746161487d0f0bd8998bb7a5bBin Chen (2):
parse the second area of android image
movebooti_setuptoarch/arm/lig/image.carch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 +++++++++++++++++++++++++++++++++++++++++ cmd/booti.c | 92 +++++++----------------------- -------------------- common/image-android.c | 19 +++++++++++ include/image.h | 11 ++++++ 5 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.c--
2.15.0
Signature · 2 lines
Regards, Bin
cover Android and arm64 improvement
Quoted 3 lines · Bin Chen
Hello Tom,
Any feedback on this?
It's on my list to grab soon, thanks!
Quoted 61 lines · Bin Chen
Quoted 50 lines
I rebased the two patches submitted (quite )a while ago on top of current U-boot master
fb4413295c765aa8c013650984dc2d908964c81d(and there were no conflicts).The first patch added the support of parsing the second area of Android image so
that it can be used for good. On Poplar board, we are using that area for dtb.
The first patch shouldn't impact any functionality since
it is new.The second patch moves the
booti_setupout ofbooti.c. It was the result of a
discusion[1] how to better support the arm64 Android image.I have boot tested it on Poplar board[2] with additional patch[3] that is built on top of the booti. I have hacked version of using bootm but it seems quit
mess up - need lots of changes in different places ("Shotgun Surgery") to handle
Android specific and/or arm64 specific code. Now, I feel a separate bootandroid command might be a cleaner solution.That being said, the second patch doesn't depend on or impact any change we might have in the future for better Android support.
[1] https://lists.denx.de/pipermail/u-boot/2017-July/297933.html
[2] https://github.com/96boards-poplar/Documentation
[3] https://github.com/pierrchen/u-boot/commit/8463e6177654026746161487d0f0bd8998bb7a5bBin Chen (2):
parse the second area of android image
movebooti_setuptoarch/arm/lig/image.carch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 +++++++++++++++++++++++++++++++++++++++++ cmd/booti.c | 92 +++++++----------------------- -------------------- common/image-android.c | 19 +++++++++++ include/image.h | 11 ++++++ 5 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.c--
2.15.0Signature · 6 lines
Regards, Bin _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de https://lists.denx.de/listinfo/u-boot
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180205/62ea4eb4/attachment.sig>
cover Android and arm64 improvement
Quoted 81 lines · Tom Rini
Quoted 3 lines · Bin Chen
Hello Tom,
Any feedback on this?
It's on my list to grab soon, thanks!
Excellent! Thanks!
Quoted 11 lines · Bin Chen
Quoted 9 lines
I rebased the two patches submitted (quite )a while ago on top of current U-boot master
fb4413295c765aa8c013650984dc2d908964c81d(and there were no conflicts).The first patch added the support of parsing the second area of Android image so
that it can be used for good. On Poplar board, we are using that areafor
Quoted 5 lines
Quoted 5 lines
dtb.
The first patch shouldn't impact any functionality since it is new.The second patch moves the
booti_setupout ofbooti.c. It was theresult
Quoted 4 lines
Quoted 4 lines
of a
discusion[1] how to better support the arm64 Android image.I have boot tested it on Poplar board[2] with additional patch[3] that
is
Quoted 3 lines
Quoted 3 lines
built on top of the booti. I have hacked version of using bootm but it seems quit
mess up - need lots of changes in different places ("Shotgun Surgery")to
Quoted 5 lines
Quoted 5 lines
handle
Android specific and/or arm64 specific code. Now, I feel a separate bootandroid command might be a cleaner solution.That being said, the second patch doesn't depend on or impact any
change we
Quoted 26 lines
Quoted 20 lines
might have in the future for better Android support.
[1] https://lists.denx.de/pipermail/u-boot/2017-July/297933.html
[2] https://github.com/96boards-poplar/Documentation
[3] https://github.com/pierrchen/u-boot/commit/8463e6177654026746161487d0f0bd8998bb7a5bBin Chen (2):
parse the second area of android image
movebooti_setuptoarch/arm/lig/image.carch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 +++++++++++++++++++++++++++++++++++++++++ cmd/booti.c | 92 +++++++----------------------- -------------------- common/image-android.c | 19 +++++++++++ include/image.h | 11 ++++++ 5 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.cQuoted 4 lines
--
2.15.0Quoted 7 lines
--
Regards,
Bin
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot--
Tom
Signature · 2 lines
Regards, Bin