[U-Boot] Booting linux zImage on vexpress-a15

Liviu Dudau liviu at dudau.co.uk
Wed Feb 6 16:58:55 UTC 2019


On Tue, Feb 05, 2019 at 07:05:55PM +0100, Andre Wagner wrote:
> Hi @all,

Hi Andre,

> 
> I'm trying to build a linux kernel as zImage and boot it with u-boot on a
> qemu vexpress-a15 machine. The host machine is a Ubuntu 18.04.
> 
> What I tried until now:
> 
> 1. Get Linux from git, export ARCH=arm and
> CROSS_COMPILE=arm-linux-gnueabihf-
> 
> 2. Make Defconfig: make vexpress_defconfig
> 
> 3. Enable 'Early Printk' with make menuconfig
> 
> 4. Make Kernel: make
> 
> 5. Get U-Boot from git, export ARCH=arm and
> CROSS_COMPILE=arm-linux-gnueabihf-
> 
> 6. Make Defconfig: make vexpress_ca15_tc2_defconfig
> 
> 7. Make U-Boot: make
> 
> 8. Generate empty image file and mount it: truncate -s 100M image; mkfs.ext4
> image; mount -o loop image /mnt
> 
> 9. Copy zImage and DTB to image: cp arch/arm/boot/zImage /mnt ; cp
> arch/arm/boot/dts/vexpress-v2p-ca15_a7.dtb /mnt
> 
> 10. Unmount Image: umount /mnt
> 
> 11. Start u-boot in qemu: qemu-system-arm -m 1024M -M vexpress-a15 -cpu
> cortex-a15 -kernel u-boot -serial stdio -sd image => U-Boot comes up and I
> can hit a key to stop automount, ok so far
> 
> 12. In u-boot, checking filesystem on image: ext4ls mmc 0:0 => I can see my
> zImage and my DTB file, ok so far
> 
> 13. In u-boot, loading kernel: ext4load mmc 0:0 82008000 zImage => XXXX
> bytes read is shown, ok so far
> 
> 14. In u-boot, loading DTB: ext4load mmc 0:0 85000000
> vexpress-v2p-ca15_a7.dtb => YYYY bytes read, ok so far
> 
> 15. In u-boot, boot: bootz 82008000 - 85000000 => 'Starting kernel ....' and
> 'Uncompressing kernel done' is shown and then nothing at all...

I think your problem is that you're putting the device tree too close to the
kernel, so it might be trampled on by the kernel decompression.

Steps I suggest you try that worked in my environment:

  1. set the bootargs variable in U-Boot to 'console=ttyAMA0 earlyprintk debug verbose'
  2. Load the kernel at 0x80008000

> 
> 
> Cross-checks I have done right now:
> 
> - Booting kernel and DTB directly from qemu with 'qemu-system-arm -m 1024M
> -M vexpress-a15 -cpu cortex-a15 -kernel arch/arm/boot/zImage  -dtb
> arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dtb -serial stdio' works, normal
> boot output is shown. Also the standard console device ttyAMA0 is available
> after mounting devtmpfs.
> 
> - Same setup with vexpress-a9  (uboot with vexpress_ca9x4_defconfig, linux
> with vexpress_defconfig and DTB vexpress-v2p-ca9.dtb. The kernel was loaded
> to 62008000 and the DTB to 65000000) worked, Normal boot output was shown.
> 
> 
> What I don't understand right now is:
> 
> - Am I using the corrected DTB? vexpress-v2p-ca15-tc1.dtb or
> vexpress-v2p-ca15_a7.dtb ? Which is the right one?

None is the right one, as they are DTBs for actual hardware that QEMU doesn't
emulate correctly with your parameters. However, the emulation should be close
enough to allow you to boot the kernel.

> 
> - What are the addresses I need to load kernel and the DTB? In the working
> vexpress-a9 sample the kernel was loaded with a offset of 2008000h and the
> DTB with a offset of 5000000h to start of RAM at 60000000h. So I decided use
> the same offsets with the alternate start of RAM address of 8000000h of
> vexpress-a15, i.e. kernel at 82008000 and DTB at 85000000. Is this
> assumption correct?

No, the offset should be 0x8000 from the start of your memory, because the kernel
for arm arch expects to be loaded at the beginning of the RAM. For DTB it doesn't
matter (other than probably faster if it is 32bit aligned).

> 
> - 'Starting kernel...' is a last message from u-boot and 'Uncompressing
> kernel done' the first from the kernels self extractor?

Correct.

> 
> - Where in RAM is the zImage decompressed by u-boot bootz? Between start of
> RAM at 80000000h and kernels loadaddr at 82008000h?

I might be wrong but I believe it decompresses in memory *after* the kernel image,
not before (otherwise the decompression might generate an image that overwrites
 the start of the kernel, which is where the decompressor lives).

> 
> - What are the differences between loading kernel and DTB by qemu directly
> and loading kernel and DTB indirectly via u-boot?

Placement in memory of the kernel image :)

Best regards,
Liviu

> 
> 
> Thank you very very much for your replies in advance.
> 
> 
> Greetings,
> 
> André
> 
> 
> +++
> Richard Wolf GmbH, Pforzheimer Strasse 32, 75438 Knittlingen
> Managing Directors: Juergen Pfab, Juergen Steinbeck. Trade Register:
> Mannheim HRB 510031 +++
> Richard Wolf GmbH routinely monitors the content of e-mail sent and received via its network for the purposes of ensuring compliance with its policies and procedures. Richard Wolf GmbH is not responsible for any changes made to the message after it has been sent. Where opinions are expressed, they are not necessarily those of Richard Wolf GmbH. This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended addressee, or the person responsible for delivering it to them, you may not copy, forward, disclose, or otherwise use it or any part of it in any way. To do so may be unlawful. If you receive this e-mail by mistake, please advise the sender immediately.
> +++
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

-- 
           ________________________________________________________
  ________|                                                        |_______
  \       |  With enough courage, you can do without a reputation  |      /
   \      |                                  -- Rhett Butler       |     /
   /      |________________________________________________________|     \
  /__________)                                                  (_________\


More information about the U-Boot mailing list