Le 19/10/2021 à 16:56, BALATON Zoltan a écrit :
On Tue, 19 Oct 2021, Christophe Leroy wrote:
Le 19/10/2021 à 15:44, Christophe Leroy a écrit :
There is something:
=> bootm 0
Wrong Image Format for bootm command
ERROR: can't get kernel image!
=> md 0
00000000: 00000000 b497aae1 616e9207 003227a4 '..V....an...2'.
00000010: 00000000 00000000 ee36255f 05070201 .........6%_....
00000020: 4c696e75 782d352e 31352e30 2d726335 Linux-5.15.0-rc5
00000030: 2d303232 32342d67 61336330 30376164 -02224-ga3c007ad
00000040: 1f8b0800 00000000 0203ec5c 0f7013e7 ...........\.p..
=> mw.l 0 0x27051956
=> bootm 0
## Booting kernel from Legacy Image at 00000000 ...
Image Name: Linux-5.15.0-rc5-02224-ga3c007ad
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 3286948 Bytes = 3.1 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
So we have something but it seems it gets overwritten by stuff.
Anyway loading a uImage at 0 is just bad because it is a gzipped
image that should get gunzipped at address 0.
Or should we just copy the raw kernel at 0 and jump to the entry
point ? But then we also need a device tree somewhere.
If I change KERNEL_LOAD_ADDR to 0x1000000, I can bootm at that
address, and it seems it properly decompress the kernel:
=> bootm 0x1000000
## Booting kernel from Legacy Image at 01000000 ...
Image Name: Linux-5.15.0-rc5-02224-ga3c007ad
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 3296789 Bytes = 3.1 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
And it initialises the MMU properly.
Then it gets stuck because there is no devicetree.
(gdb) bt
#0 0xc00094cc in udelay ()
#1 0xc0025d34 in panic ()
#2 0xc06415a0 in early_init_devtree ()
#3 0xc0641da8 in machine_init ()
#4 0xc0002200 in start_here ()
Maybe you need to embed a dtb in your kernel if that's possible somehow?
Or QEMU has a -dtb option that sets machine->dtb but you need board code
to do something with it. See how it's done in other boards like
virtex_ml507 and sam460ex. But maybe you'd be better off not using
-kernel option as it seems to not really working for these 405 boards
but load and start the kernel from u-boot. Not sure what device does
u-boot support but QEMU can emulate usb-storage, network, different
disks so something might work with u-boot if this board has any
peripherals. If it doesn't emulate any peripherals what do you expect to
do with the kernel once it boots?
I should be able to build a multi-FIT image that embeds the kernel and
the device tree.
I don't know about the peripherals, what I need it a kernel that is able
to boot and run some user exe. I'm working on low level functionnalities
like VMAP_STACK, STRICT_KERNEL_RWX, Userspace protection, etc ... I want
to be able to check that after some modifications the kernel can still
boot on every CPU sub-family, and I need to run LKDTM tests.
For this a kernel + initrd is enough.
Thanks
Christophe