umanovskis / baremetal-arm

An ebook about bare-metal programming for ARM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

U-Boot section: Wrong command?

dueringa opened this issue · comments

Hi,

in doc/03_bootloader.md, you say to modify the U-Boot config, specifically setting CONFIG_BOOTCOMMAND="run mmc_elf_bootcmd", while in the next paragraph, you add a bootcommand / environment variable bootcmd_bare_arm.
Is this intended? Shouldn't it be CONFIG_BOOTCOMMAND="run bootcmd_bare_arm"?

Because this way, when I start U-Boot in qemu, I get an error ## Error: "mmc_elf_bootcmd" not defined , i.e. the autoboot doesn't work

@dueringa

you have to change

CONFIG_BOOTCOMMAND="run mmc_elf_bootcmd"

to

CONFIG_BOOTCOMMAND="run bootcmd_bare_arm"

@csukuangfj That's what I meant to type, actually

hey i was just working through the arm-baremetal-ebook.pdf and came across this same issue.

no biggie i thought i'd just bring it to your attention.

excellent project tyvm

^^
Like tristenator, I found the same issue.

This project is super sweet.

u-boot-2018.09/tools/mkimage -A arm -C none -T kernel -a 0x60000000 -e 0x60000000 -d better-hang.elf bare-arm.uimg

later in test it's not ELF, but BIN

Your suggestion work but i have now this problem...
...
...
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
108 bytes read in 12 ms (8.8 KiB/s)

Booting kernel from Legacy Image at 60000000 ...

Image Name:
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 44 Bytes = 44 Bytes
Load Address: 60000000
Entry Point: 60000000
Verifying Checksum ... OK
Working FDT set to 0
Loading Kernel Image
FDT and ATAGS support not compiled in

resetting ...

Trying to run in qemu, and got the same message:

boot sequence:

bootm 0x60000000

Booting kernel from Legacy Image at 60000000 ...

Image Name:
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4652 Bytes = 4.5 KiB
Load Address: 60000000
Entry Point: 60000000
Verifying Checksum ... OK
Working FDT set to 0
Loading Kernel Image to 60000000
FDT and ATAGS support not compiled in

resetting...

With
U-Boot 2024.04-rc4-00021-g86fd291a79-dirty
arm-none-eabi-gcc (15:12.2.rel1-1) 12.2.1 20221205
debian 12

u-boot printenv gives:

kernel_addr_r=0x60100000
fdt_addr_r=0x60000000
fdtcontroladdr=6087fbb0
fdtfile=vexpress-v2p-ca9.dtb
bootcmd=run mmc_elf_bootcmd
mmc_elf_bootcmd=mmc dev 0;ext2load mmc 0 0x60000000 bare-arm.uimg;bootm 0x60000000;
mtd=armflash:1M@0x800000(uboot),7M@0x1000000(kernel),24M@0x2000000(initrd)

I think it is supposed to start.

Is it related somehow to fdtcontroladdr? or fdtfile?

Trying to run in qemu, and got the same message:
...
I think it is supposed to start.

Is it related somehow to fdtcontroladdr? or fdtfile?

No, with the u-boot version explicitely mentioned in the doc (2018.09), it works.