move booti_setup to arch/arm/lig/image.c
RFC 1/1 move booti_setup to arch/arm/lig/image.c
Follow bootz's pattern by moving the booti_setup to arch/arm/lib. This allows to use that function in other path, e.g booting an android image contains 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).
--- arch/arm/lib/Makefile | 2 +- arch/arm/lib/image.c | 76 ++++++++++++++++++++++++++++++++++++++++++ cmd/booti.c | 92 ++++++++------------------------------------------- include/image.h | 10 ++++++ 4 files changed, 100 insertions(+), 80 deletions(-) create mode 100644 arch/arm/lib/image.c
arch/arm/lib/Makefile +1 -1
@@ -26,7 +26,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 +10 -0
@@ -848,6 +848,16 @@ 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, +* also kernel relocation inside, if needed. +* +* @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
1.9.1
Quoted 8 lines · Bin Chen
Follow bootz's pattern by moving the
booti_setuptoarch/arm/lib. This allows to use that function in other path, e.g booting an android image contains 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).
Just to be clear, did you boot test this path on hardware?
And, a minor comment:
cmd/booti.c static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc, · line 52
Quoted 8 lines
cmd/booti.c +5
-3- ih = (struct Image_header *)map_sysmem (images->ep,0 ); - -lmb_reserve (&images->lmb, images->ep,le32_to_cpu (ih->image_size)); +/* Handle BOOTM_STATE_LOADOS */ +if (relocated_addr != ld) { +debug ("Moving Image from 0x%lx to 0x%lx\n" , ld, relocated_addr); +memmove ((void *)relocated_addr, (void *)ld, image_size); + }
Please correct the indentation here.
Otherwise, and assuming you've booted the kernel with this patch, fix the above, post as v2 instead and:
Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170807/147a0b08/attachment.sig>
Quoted 6 lines · Tom Rini
Quoted 4 lines · Bin Chen
Follow bootz's pattern by moving the
booti_setuptoarch/arm/lib. This allows to use that function in other path, e.g booting an android image contains Image format.
Quoted 7 lines
Quoted 4 lines
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).Just to be clear, did you boot test this path on hardware?
yes, I tested the booti path with this patch applied.
Quoted 11 lines
And, a minor comment:
cmd/booti.c static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc, · line 52
Quoted 8 lines
cmd/booti.c +5
-3- ih = (struct Image_header *)map_sysmem (images->ep,0 ); - -lmb_reserve (&images->lmb, images->ep,le32_to_cpu (ih->image_size)); +/* Handle BOOTM_STATE_LOADOS */ +if (relocated_addr != ld) { +debug ("Moving Image from 0x%lx to 0x%lx\n" , ld, relocated_addr); +memmove ((void *)relocated_addr, (void *)ld, image_size); + }
Quoted 2 lines
Please correct the indentation here.
OK. Thanks for the review!
Quoted 11 lines
Otherwise, and assuming you've booted the kernel with this patch, fix the above, post as v2 instead and:
Reviewed-by Tom Rini <[email protected]>Thanks!
--
Tom
Signature · 2 lines
Regards, Bin