I have a 32bit (
aarch32) kernel I’d like to load in EL2 on the TX2. The TX2 boot flow diagram shows that both
u-boot are running in
aarch64-EL2 mode, and I don’t think
u-boot has the option to load an
aarch32 kernel from the same EL.
My question is: Is my overall goal (
aarch32 kernel) possible? To do it, do I need to replace both
cboot with their respective
aarch32 versions? Does the Monitor/ATF (from the boot flow diagram) even support a 32bit
Historically, U-Boot and CBoot were always 32-bit. They’ve existed since the days when only arm32 was around, although there were probably some edits to get to 32-bit mode.
The CPU is ARMv8-a when in 64-bit mode, but ARMv8 when in 32-bit compatibility mode. Keep in mind that the original ARMv7-a 32-bit mode did not have any command to switch to 64-bit mode, and that ARMv8 32-bit is a superset of arm32. Even if you work with an otherwise purely 32-bit kernel, expect that you’ll need some 64-bit support to get there. I have not actually done this, so I am only working in my head with what I know.
In the old days of the PC when we were transitioning from 32-bit to 64-bit it was known far ahead that compilers would need both a 64-bit native mode and a 32-bit foreign mode since 64-bit would not have been accepted by the general public unless old software was also supported. The kernels which were being built then used compilers directly supporting both modes. ARM did not do this.
If you look at the cross compile instructions from the first arm64 days, you’ll see that two compilers were specified with these options to “
make” when working on the kernel:
make CROSS_COMPILE=/some/64bit/gccprefix CROSS32CC=/some/32bit/gccprefix ...
Most of that first kernel was 64-bit, and a few releases later the “
CROSS32CC” was dropped. During the earlier releases a feature used was vdso32. If you were to compile without specifying the second 32-bit compiler, then you would fail at that step, but succeed at other steps.
I don’t know if you will get a 32-bit kernel to work, but if you do, then it is likely you must specify both a 64-bit compiler and a 32-bit compiler. If you are compiling in a native 64-bit environment, then perhaps you don’t need to name the 64-bit compiler prefix.
It is very likely you will need some 64-bit code in order to put the CPU in 32-bit mode. Don’t know for sure.