Skip to contentSkip to conversation

armv8: Support loading 32-bit OS which is not in the form of FIT

PATCH In review Alison Wang 3 participants 4 messages Jun 6, 2017 – Jun 10, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 armv8: Support loading 32-bit OS which is not in the form of FIT

As only FIT image is supported now, this patch is to support loading 32-bit uImage, dtb and rootfs separately.

---
 include/image.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/image.h +2 -1
index 8d380e0..fcfe730 100644
@@ -785,7 +785,8 @@ static inline int image_check_type(const image_header_t *hdr, uint8_t type)
 }
 static inline int image_check_arch(const image_header_t *hdr, uint8_t arch)
 {
-	return (image_get_arch(hdr) == arch);
+	return (image_get_arch(hdr) == arch) ||
+		(image_get_arch(hdr) == IH_ARCH_ARM && arch == IH_ARCH_ARM64);
 }
 static inline int image_check_os(const image_header_t *hdr, uint8_t os)
 {
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH 1/1 armv8: Support loading 32-bit OS which is not in the form of FIT

Quoted 4 lines · Alison Wang

As only FIT image is supported now, this patch is to support loading 32-bit uImage, dtb and rootfs separately.

However, entirely unrelated, I found this while reviewing the patch:

$ grep IH_ARCH_ arch/arm/include/asm/arch-fsl-layerscape/mp.h
#define IH_ARCH_ARM             2       /* ARM */
#define IH_ARCH_ARM64           22      /* ARM64 */

And that's dangerous and whatever needs those defines needs to be using <image.h> instead where we have the canonical enum of those values. Please correct this, 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/20170606/1fcab44c/attachment.sig>
#2 lore raw

PATCH 1/1 armv8: Support loading 32-bit OS which is not in the form of FIT

Hi, Tom,

Quoted 9 lines · Alison Wang
Quoted 5 lines

As only FIT image is supported now, this patch is to support loading 32-bit uImage, dtb and rootfs separately.

Quoted 9 lines

However, entirely unrelated, I found this while reviewing the patch:

$ grep IH_ARCH_ arch/arm/include/asm/arch-fsl-layerscape/mp.h
#define IH_ARCH_ARM             2       /* ARM */
#define IH_ARCH_ARM64           22      /* ARM64 */

And that's dangerous and whatever needs those defines needs to be using <image.h> instead where we have the canonical enum of those values. Please correct this, thanks!

[Alison Wang] Thanks for your suggestion. Yes, it's dangerous and <image.h> should be used.

In <image.h>, IH_ARCH_ARM and IH_ARCH_ARM64 are defined in an enumeration type. In the assembly file arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S, IH_ARCH_DEFAULT is used.

#ifndef CONFIG_ARM64
#define IH_ARCH_DEFAULT IH_ARCH_ARM
#else
#define IH_ARCH_DEFAULT IH_ARCH_ARM64
#endif

So IH_ARCH_ARM or IH_ARCH_ARM64 need to be used in the assembly code. The way to include <image.h> in the assembly file will cause more problems.

I will send a patch to use IH_ARCH_ARM and IH_ARCH_ARM64 in the C programming, and remove the duplicate definition in mp.h.

Best Regards,
Alison Wang

#3 lore raw
In reply to Alison Wang
Quoted 5 lines · Alison Wang

As only FIT image is supported now, this patch is to support loading 32-bit uImage, dtb and rootfs separately.

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170610/966c12bf/attachment.sig>