booting Beaglebone Black

Brook Milligan <[email protected]>
Newsgroups gmane.os.netbsd.ports.arm
Message-ID <[email protected]>
As far as I can tell, NetBSD currently does not boot on the Beaglebone Black.  Specifically, efiboot is loaded but then resets (see the console log below).

If anyone can help me, I am happy to try to test fixes to efiboot, but this is currently outside my comfort zone.

In the meantime, I suggest the attached modification to /boot/boot.cmd (and of course /boot/boot.scr which is made from it).  The intent is to detect this board and boot netbsd.ub directly instead of using efiboot.

Comments welcome, especially ways to make efiboot work with the BBB.

Thanks a lot.

Cheers,
Brook


U-Boot 2019.04-00002-g31a8ae0206 (May 13 2020 - 09:26:17 -0500), Build: jenkins-github_Bootloader-Builder-139

CPU  : AM335X-GP rev 2.1
I2C:   ready
DRAM:  512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4... 
** Unable to use mmc 0:1 for loading the env **
Board: BeagleBone Black
<ethaddr> not set. Validating first E-fuse MAC
BeagleBone Black:
BeagleBone: cape eeprom: i2c_probe: 0x54:
BeagleBone: cape eeprom: i2c_probe: 0x55:
BeagleBone: cape eeprom: i2c_probe: 0x56:
BeagleBone: cape eeprom: i2c_probe: 0x57:
Net:   eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 0 seconds
board_name=[A335BNLT] ...
board_rev=[00C0] ...
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
201 bytes read in 3 ms (65.4 KiB/s)
## Executing script at 80000000
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
95747 bytes read in 42 ms (2.2 MiB/s)
Found EFI removable media binary efi/boot/bootarm.efi
78Scanning disks on usb...
Disk usb0 not ready
Disk usb1 not ready
Disk usb2 not ready
Disk usb3 not ready
Scanning disks on mmc...
MMC Device 2 not found
MMC Device 3 not found
Found 5 disks
BootOrder not defined
171568 bytes read in 22 ms (7.4 MiB/s)
## Starting EFI application at 82000000 ...

  \\-__,------,___.
   \\        __,---`  NetBSD/evbarm efiboot (arm)
    \\       `---,_.  Revision 2.13 (Thu Mar 28 08:33:33 UTC 2024)
     \\-,_____,.---`
      \\
       \\
        \\

Press return to boot now, any other key for boot prompt
booting netbsd - starting in 5 seconds. 4 seconds. 3 seconds. 2 seconds. 1 seconds. 0 seconds.     
7830420+2499680+1399712 [457491+548512+596646]=0xcbfb9c
data abort
pc : [<9ff5a188>]   lr : [<9ff5a1bd>]
reloc pc : [<80801188>]   lr : [<808011bd>]
sp : 9df371a4  ip : 1f759000 fp : 00000000
r10: 9ff5b000  r9 : 9df38eb8 r8 : 00000000
r7 : 9ff5a408  r6 : 9ff5a3bc r5 : 000000ad  r4 : 00048408
r3 : 00000000  r2 : 00000050 r1 : 9ff5a3b8  r0 : abb1aaad
Flags: NzCv  IRQs off  FIQs on  Mode SVC_32
Code: 2010ea83 bdf0d1f5 5b04f856 b2c54068 (5025f854) 
UEFI image [0x9cf05000:0x9cf2d85f] '/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USB(0x6,0x0)/HD(1,0x01,0,0x2800000000000,0x0)/efi\boot\bootarm.efi'
Resetting CPU ...

resetting …
cvs.diff (application/octet-stream, 3.7 KB)
Index: distrib/utils/embedded/files/armv7_boot.cmd
===================================================================
RCS file: /cvsroot/src/distrib/utils/embedded/files/armv7_boot.cmd,v
retrieving revision 1.15
diff -u -r1.15 armv7_boot.cmd
--- distrib/utils/embedded/files/armv7_boot.cmd	27 Oct 2019 21:38:58 -0000	1.15
+++ distrib/utils/embedded/files/armv7_boot.cmd	23 Jun 2024 22:05:14 -0000
@@ -1,8 +1,85 @@
+# $NetBSD$
+#
+# U-Boot boot script
+
+# This file is typically loaded and run early in the U-Boot boot
+# process.  As a result, it has the opportunity to boot a kernel
+# immediately, change the U-Boot environment, or otherwise affect the
+# boot process.  Good practice is to modify the U-Boot environment to
+# prevent recursion.  Additionally, the contents of this file should
+# be consistent with the U-Boot process of booting, which in brief is
+# the following.
+
+# U-Boot first initializes the board and creates the environment,
+# which contains both variables describing the specific board and boot
+# parameters, as well as variables containing commands to be run.  One
+# of these, bootcmd, is the entry point for automatic booting after a
+# timeout occurs.  Although bootcmd can be redefined, e.g., either at
+# compile time in the board-specific configuration file or at runtime
+# via the console, the default definition generally defines additional
+# environment variables and selects a method of booting a kernel.
+#
+# After initialization, the file boot.scr, which is created by
+# mkubootimage(1) from this file (see ../conf/armv7.conf), is loaded
+# and run if it exists.  If boot.scr returns, then if it exists the
+# file uEnv.txt, which contains a set of key=value pairs, is loaded
+# into the environment.  Next, if the environment variable uenvcmd is
+# not empty, it is run; this provides an opportunity for uEnv.txt to
+# define an alternate boot command.  Finally, the environment command
+# distro_bootcmd is run, which iterates through a series of boot
+# options to boot a kernel.  The set of boot options can be modified
+# by removing or redefining various boot_* or other environment
+# variables in either boot.scr or uEnv.txt.
+#
+# NetBSD uses UEFI (e.g., bootaa64.efi or bootarm.efi) to boot most
+# aarch64 and arm embedded platforms.  Any boards, e.g., am335x, that
+# cannot boot via UEFI are handled specially here.
+#
+
+if test "${soc}" = "am33xx" ; then
+	setenv kernel "netbsd-GENERIC.ub"
+	setenv bootargs "root=ld0a"
+	setenv dtbdir "dtb"
+	setenv fdtodir "overlays"
+	setenv fdto_addr_r 0x83000000
+	setenv bootpart 0:1
+	setenv use_fdt 1
+else
+	setenv use_efi 1
+fi
+
 if test "${soc}" = "tegra210" ; then
 	# enable PCIe
 	pci enum
 fi
 
-setenv boot_scripts
-setenv boot_script_dhcp
-run distro_bootcmd
+if test "${use_efi}" = "1" ; then
+	# prevent recursion, but continue boot process
+	setenv boot_scripts
+	setenv boot_script_dhcp
+	run distro_bootcmd
+else
+	# boot non-UEFI boards immediately
+	if test "${use_fdt}" = "1" ; then
+		if run loadbootenv; then
+			echo Loaded env from ${bootenvfile}
+			echo env import -t ${loadaddr} ${filesize}
+			run importbootenv
+		fi
+		load mmc ${mmcdev}:${mmcpart} ${kernel_addr_r} ${kernel}
+		load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${dtbdir}/${fdtfile}
+		fdt addr ${fdt_addr_r}
+		fdt resize 8192
+		for f in ${overlays}; do
+			echo Loading fdt overlay ${fdtodir}/${f}
+			load mmc ${mmcdev}:${mmcpart} ${fdto_addr_r} ${fdtodir}/${f}
+			fdt apply ${fdto_addr_r}
+		done
+		echo Booting NetBSD: ${kernel} ${bootargs} ${dtbdir}/${fdtfile} ...
+		bootm ${kernel_addr_r} - ${fdt_addr_r}
+	else
+		load mmc ${mmcdev}:${mmcpart} ${kernel_addr_r} ${kernel}
+		echo Booting NetBSD: ${kernel} ${bootargs} ...
+		bootm ${kernel_addr_r} ${bootargs}
+	fi
+fi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.