
On Mon, Aug 7, 2017 at 11:47 AM, Jonathan Gray jsg@jsg.id.au wrote:
On Sun, Aug 06, 2017 at 11:34:15AM -0400, Rob Clark wrote:
On Sun, Aug 6, 2017 at 10:45 AM, Rob Clark robdclark@gmail.com wrote:
I've started trying to hack up test_efi_loader.py to add a test that loads OpenBSD's bootloader.. kinda muddling through it at this point, since not a py expert or too familiar w/ u-boot's test framework. But I'll see if I can get to the point where I can run the same thing on various arm7 and aarch64 devices in qemu.
Making a bit of progress on this (running it on a vexpress_ca15_tc2 board in qemu).. any hint where I can find BOOTARM.EFI src code?
=> tftpboot 80400000 obsdboot.efi smc911x: MAC 52:54:00:12:34:56 smc911x: detected LAN9118 controller smc911x: phy initialized smc911x: MAC 52:54:00:12:34:56 Using smc911x-0 device TFTP from server 10.0.2.2; our IP address is 10.0.2.15 Filename 'obsdboot.efi'. Load address: 0x80400000 Loading: *%08##### 12.4 MiB/s done Bytes transferred = 64908 (fd8c hex) smc911x: MAC 52:54:00:12:34:56 => crc32 80400000 $filesize CRC32 for 80400000 ... 8040fd8b ==> a9ac4fcf => bootefi 80400000 ## Starting EFI application at 80400000 ... WARNING: Invalid device tree, expect boot to fail BS->LocateHandle() returns 0 undefined instruction pc : [<9eec65c4>] lr : [<9eeca390>] sp : 9fed7a18 ip : 0000003f fp : 9fed7a2c r10: 00000000 r9 : 9eed4658 r8 : 00000000 r7 : 9eed1ce4 r6 : 9eed3538 r5 : 9fed7a6c r4 : 9eed4658 r3 : 00000000 r2 : 9eed2f8e r1 : 9eed1ee0 r0 : 00000000 Flags: nZCv IRQs off FIQs off Mode SVC_32 Resetting CPU ...
resetting ...
U-Boot 2017.09-rc1-00025-g534695d189 (Aug 06 2017 - 06:58:16 -0400)
DRAM: 1 GiB WARNING: Caches not enabled Flash: 128 MiB MMC: MMC: 0 *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Net: smc911x-0 Hit any key to stop autoboot: 2
Why does U-Boot not set fdt_addr_r or fdtfile for vexpress? Worse yet trying to load to the default kernel_addr_r fails. So it requires a script or manual commands to boot instead of the usual distro boot arrangement?
I suspect this is specific to the test framework (probably not enabling distro-boot-cmd so that the test framework can run the cmds it wants??)
BR, -R
There is some kind of hard hang on OpenBSD with vexpress at the moment and there is no driver for the sd/mmc but getting to that point seemed quite a bit more painful than using U-Boot on real hardware.
After adding vexpress-v2p-ca15-tc1.dtb to the FAT16 on miniroot-panda-61.fs:
$ qemu-system-arm -M vexpress-a15 -kernel vexpress_ca15_tc2/u-boot -nographic -sd miniroot-panda-61.fs
U-Boot 2017.09-rc1 (Aug 02 2017 - 10:55:19 +1000)
DRAM: 128 MiB WARNING: Caches not enabled Flash: 128 MiB MMC: MMC: 0 *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Net: smc911x-0 Hit any key to stop autoboot: 0 MMC Device 1 not found no mmc device at slot 1 switch to partitions #0, OK mmc0 is current device env - environment handling commands
Usage: env default [-f] -a - [forcibly] reset default environment env default [-f] var [...] - [forcibly] reset variable(s) to their default values env delete [-f] var [...] - [forcibly] delete variable(s) env export [-t | -b | -c] [-s size] addr [var ...] - export environment env import [-d] [-t [-r] | -b | -c] addr [size] - import environment env print [-a | name ...] - print environment env run var [...] - run commands in an environment variable env save - save environment env set [-f] name [arg ...]
Scanning mmc 0:1... Found EFI removable media binary efi/boot/bootarm.efi reading efi/boot/bootarm.efi 64908 bytes read in 52 ms (1.2 MiB/s) ## Starting EFI application at a0008000 ... WARNING: Invalid device tree, expect boot to fail efi_load_pe: Invalid DOS Signature ## Application terminated, r = 2147483646 EFI LOAD FAILED: continuing... smc911x: MAC 52:54:00:12:34:56 smc911x: detected LAN9118 controller smc911x: phy initialized smc911x: MAC 52:54:00:12:34:56 BOOTP broadcast 1 DHCP client bound to address 10.0.2.15 (3 ms) *** Warning: no boot file name; using '0A00020F.img' Using smc911x-0 device TFTP from server 10.0.2.2; our IP address is 10.0.2.15 Filename '0A00020F.img'. Load address: 0xa0008000 Loading: * TFTP error: 'Access violation' (2)
...
=> setenv fdt_addr_r 0x81000000 => setenv fdtfile vexpress-v2p-ca15-tc1.dtb reading vexpress-v2p-ca15-tc1.dtb 13384 bytes read in 22 ms (593.8 KiB/s) => load mmc 0:1 ${kernel_addr_r} efi/boot/bootarm.efi reading efi/boot/bootarm.efi 64908 bytes read in 51 ms (1.2 MiB/s) => bootefi ${kernel_addr_r} ${fdt_addr_r} ## Starting EFI application at a0008000 ... efi_load_pe: Invalid DOS Signature ## Application terminated, r = 2147483646 => printenv kernel_addr_r kernel_addr_r=0xa0008000
=> setenv kernel_addr_r 0x82000000 => load mmc 0:1 ${kernel_addr_r} efi/boot/bootarm.efi reading efi/boot/bootarm.efi 64908 bytes read in 49 ms (1.3 MiB/s) => bootefi ${kernel_addr_r} ${fdt_addr_r} ## Starting EFI application at 82000000 ... Scanning disks on mmc... MMC Device 1 not found MMC Device 2 not found MMC Device 3 not found Found 1 disks
OpenBSD/armv7 BOOTARM 0.8
boot> cannot open sd0a:/etc/random.seed: No such file or directory booting sd0a:/bsd: 2265112+7989364+447000 [80+314496+149702]=0xaad1c0
OpenBSD/armv7 booting ... arg0 0xc0dad1c0 arg1 0x8e0 arg2 0x86ed0000 Allocating page tables freestart = 0x80dae000, free_pages = 29266 (0x00007252) IRQ stack: p0x80ddc000 v0xc0ddc000 ABT stack: p0x80ddd000 v0xc0ddd000 UND stack: p0x80dde000 v0xc0dde000 SVC stack: p0x80ddf000 v0xc0ddf000 Creating L1 page table at 0x80db0000 Mapping kernel Constructing L2 page tables undefined page pmap board type: 2272 Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. Copyright (c) 1995-2017 OpenBSD. All rights reserved. https://www.OpenBSD.org
OpenBSD 6.1-current (RAMDISK) #30: Sat Aug 5 22:01:16 MDT 2017 deraadt@armv7.openbsd.org:/usr/src/sys/arch/armv7/compile/RAMDISK real mem = 134217728 (128MB) avail mem = 117125120 (111MB) mainbus0 at root: V2P-CA15 cpu0 at mainbus0: ARM Cortex-A15 r2p1 (ARMv7) cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled cpu0: 32KB(64b/l,2way) I-cache, 32KB(64b/l,2way) wr-back D-cache cortex0 at mainbus0 ampintc0 at mainbus0 nirq 160, ncpu 1 agtimer0 at mainbus0: tick rate 62500 KHz simplebus0 at mainbus0: "smb" simplebus1 at simplebus0: "motherboard" simplebus2 at simplebus1: "iofpga" sysreg0 at simplebus2: ID 0x1190f500 PROCID0 0x14000237 pluart0 at simplebus2: console pluart1 at simplebus2 pluart2 at simplebus2 pluart3 at simplebus2 plrtc0 at simplebus2 simplebus3 at mainbus0: "hsb" boot device: lookup 'sd0a:/bsd' failed. root on rd0a swap on rd0b dump on rd0b e