Skip to content

Instantly share code, notes, and snippets.

@Grogdor
Last active January 26, 2018 02:08
Show Gist options
  • Save Grogdor/99550a2b239286b65e53717257a3cb47 to your computer and use it in GitHub Desktop.
Save Grogdor/99550a2b239286b65e53717257a3cb47 to your computer and use it in GitHub Desktop.
NanoPi Neo notes
-=-=-=-=-=-=-=-=-=-=-= u-boot/spl onto sdcard da0 =-=-=-=-=-=-=-=-=-
/usr/ports/sysutils/u-boot-nanopi-neo/make install clean
dd if=/usr/local/share/u-boot/u-boot-nanopi_neo/u-boot-sunxi-with-spl.bin of=/dev/da0 bs=1024 seek=8
dd if=/usr/local/share/u-boot/u-boot-nanopi_neo/u-boot.img conv=notrunc,sync of=/dev/da0 bs=1024 seek=40
-=-=-=-=-=-=-=-= partition sdcard, 8MB msdos /boot, remainder UFS =-=-=-=-=-=-=-
(clear card's partitions first? gpart list/delete/destroy)
gpart create -s MBR da0
gpart add -t \!12 -b 1M -s 8m da0
(8MB seems alright, check map/offsets/FAT type if bigger)
gpart set -a active -i 1 da0
newfs_msdos -F12 /dev/da0s1
gpart add -t freebsd da0
gpart create -s BSD da0s2
gpart add -t freebsd-ufs da0s2
newfs /dev/da0s2a
Filesystem flags per crochet's disk.sh functions, but journaling? On an SD card? Also HEAD's "cylinder checksum" annoying messages and eventual disk errors...
tunefs -n enable /dev/da0s2a
tunefs -j enable -S 4194304 /dev/da0s2a
tunefs -N enable /dev/da0s2a
-=-=-=-=-=-=-= card ready to populate =-=-=-=-=-=-
mount_msdosfs /dev/da0s1 /mnt
cp /root/arm7obj/usr/src/arm.armv7/stand/arm/uboot/ubldr /mnt
( ^ detail buildworld/ubldr process from armbuild.sh, note new location in /stand instead of /boot, thanks HEAD)
(look into ubldr vs. ubldr.bin epic struggle of standardization)
cp /root/sun8i-h3-nanopi-neo.dtb /mnt
( ^ how was this made, why use FDT vs DTB, etc)
( /usr/src/sys/tools/fdt/make_dtb.sh /usr/src/sys /root/linuxdts/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts /root )
(used the newest dts from Linux tree for ethernet awg0 support, not sure I'm getting all the proper devices though, doublecheck USB busses)
-=-=-=-=-=-=-=-=-=-=-=-= try card in device, full paste near eof =-=-=-=-=-=-=-=-
U-Boot SPL 2017.09 (Jan 12 2018 - 16:11:26)
...
U-Boot 2017.09 (Jan 12 2018 - 16:11:26 -0700) Allwinner Technology
...
Booting from disk0s2a:
can't load 'kernel'
loader>
(success thus far)
(NB: already did an armv7 buildworld to get ubldr so we're skipping buildworld or kernel-toolchain)
/usr/src/env MAKEOBJDIRPREFIX=/root/arm7obj make -j4 buildkernel ARCH=arm TARGET_ARCH=armv7 KERNCONF=GENERIC
(^ KERNCONF=GENERIC is redundant -- unless you're on STABLE which needs "ALLWINNER" - don't think ARCH is needed either)
mount /dev/da0s2a /mnt
/usr/src/env MAKEOBJDIRPREFIX=/root/arm7obj make installworld -DWITHOUT_SHAREDOCS -DWITHOUT_EXAMPLES -DWITHOUT_GAMES -DWITHOUT_HTML -DWITHOUT_INFO -DWITHOUT_MAN ARCH=arm TARGET_ARCH=armv7 DESTDIR=/mnt
/usr/src/env MAKEOBJDIRPREFIX=/root/arm7obj make distribution TARGET_ARCH=armv7 DESTDIR=/mnt
/usr/src/env MAKEOBJDIRPREFIX=/root/arm7obj make installkernel TARGET_ARCH=armv7 KERNCONF=GENERIC DESTDIR=/mnt
*** add fstab, rc.conf, makeswap, what else?
-=-=-=-=-=-=-=-=-=-=-=-= References =-=-=-=-=-=-=-=-=-=-=-=-
(check dates/versions because: armv6 vs armv7 in FreeBSD 12+, redundant/obsolete commands, pay attention to csh/sh/bash script differences)
https://github.com/freebsd/crochet (lib/tools.sh for disk operations, Cubieboard2 and others setup.sh for flow)
https://www.bidouilliste.com/blog/2015/11/27/Porting-FreeBSD-to-a-new-ARM-Board-Part-1/
https://www.bidouilliste.com/blog/2015/11/28/Porting-FreeBSD-to-a-new-ARM-Board-Part-2/
https://www.bidouilliste.com/blog/2016/02/10/Porting-FreeBSD-to-a-new-ARM-Board-Part-3/
https://wiki.freebsd.org/FreeBSD/arm/Allwinner
https://linux-sunxi.org/Bootable_SD_card#Bootloader
https://wiki.freebsd.org/FreeBSD/arm/crossbuild
(^ good crossbuild guide)
https://wiki.freebsd.org/FlattenedDeviceTree#How_to_convert_a_platform_to_FDT
https://wiki.freebsd.org/A_Brief_Guide_To_Cross_Compiling_FreeBSD
(^ 2015, not very useful)
https://wiki.freebsd.org/EmbeddedHandbook
(^ -DWITHOUT_ strippage, debug stuff)
-=-=-=-=-=-=-=-=-=-=-= try card in device: =-=-=-=-=-=-=-=-=-=-=-
U-Boot SPL 2017.09 (Jan 12 2018 - 16:11:26)
DRAM: 512 MiB
Trying to boot from MMC1
U-Boot 2017.09 (Jan 12 2018 - 16:11:26 -0700) Allwinner Technology
CPU: Allwinner H3 (SUN8I 1680)
Model: FriendlyARM NanoPi NEO
DRAM: 512 MiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: phy interface0
eth0: ethernet@1c30000
starting USB...
USB0: USB EHCI 1.00
USB1: USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
reading /sun8i-h3-nanopi-neo.dtb
23646 bytes read in 26 ms (887.7 KiB/s)
Found FreeBSD U-Boot Loader (elf)
reading ubldr
892612 bytes read in 64 ms (13.3 MiB/s)
CACHE: Misaligned operation at range [42000098, 4202e744]
CACHE: Misaligned operation at range [4202e750, 4202ed7f]
CACHE: Misaligned operation at range [4202ed80, 42030790]
CACHE: Misaligned operation at range [42030790, 42034e17]
CACHE: Misaligned operation at range [42034e20, 42036524]
CACHE: Misaligned operation at range [42036524, 4203657c]
CACHE: Misaligned operation at range [4203657c, 42036afc]
CACHE: Misaligned operation at range [42036afc, 42036cac]
CACHE: Misaligned operation at range [42036cac, 42036cb8]
CACHE: Misaligned operation at range [42036cb8, 42039920]
## Starting application at 0x42000098 ...
Consoles: U-Boot console
Compatible U-Boot API signature found @0x5bf3f3c0
FreeBSD/armv7 U-Boot loader, Revision 1.2
(Sat Jan 13 15:54:44 MST 2018 root@HEAD)
DRAM: 512MB
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Number of U-Boot devices: 1
U-Boot env: loaderdev not set, will probe all devices.
Found U-Boot device: disk
Probing all disk devices...
Checking unit=0 slice=<auto> partition=<auto>... good.
Booting from disk0s2a:
\
can't load 'kernel'
Type '?' for a list of commands, 'help' for more detailed help.
loader>
-=-=-=-=-=-=-=-=-=-=-=--=-=-=- env =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=> env print
api_address=5bf3f3c0
arch=arm
baudrate=115200
board=sunxi
board_name=sunxi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_freebsd_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ubldr.bin; go ${kernel_addr_r}
boot_freebsd_elf=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ubldr; bootelf ${kernel_addr_r}
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=fel mmc0 usb0 pxe dhcp
bootcmd=run distro_bootcmd
bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_fel=if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then echo '(FEL boot)'; source ${fel_scriptaddr}; fi
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot
bootdelay=2
bootfstype=fat
bootm_size=0xa000000
console=ttyS0,115200
cpu=armv7
devnum=0
devplist=1
devtype=usb
dfu_alt_info_ram=kernel ram 0x42000000 0x1000000;fdt ram 0x43000000 0x100000;ramdisk ram 0x43300000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
ethact=ethernet@1c30000
ethaddr=02:81:8b:bc:b1:9e
fdt_addr_r=0x43000000
fdtcontroladdr=5bf3a048
fdtfile=sun8i-h3-nanopi-neo.dtb
kernel_addr_r=0x42000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
preboot=usb start
pxefile_addr_r=0x43200000
ramdisk_addr_r=0x43300000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;run scan_dev_for_freebsd;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_freebsd=if test -e ${devtype} ${devnum}:${distro_bootpart} ubldr.bin; then echo Found FreeBSD U-Boot Loader (bin);run boot_freebsd_binary; echo FREEBSD FAILED: continuing...; elif test -e ${devtype} ${devnum}:${distro_bootpart} ubldr; then echo Found FreeBSD U-Boot Loader (elf);run boot_freebsd_elf; echo FREEBSD FAILED: continuing...; fi;
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x43100000
serial#=02c000818bbcb19e
soc=sunxi
stderr=serial
stdin=serial,usbkbd
stdout=serial
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
Environment size: 4757/131068 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment