Others: 由FriendlyElec出品的NanoPi NEO

NanoPi NEO所使用的CPU为Allwinner H3, 四核Cortex-A7, 最高主频1.2GHz,同时还包含:

– DDR3 RAM: 256MB/512MB

– Connectivity: 10/100M Ethernet

– USB Host: Type-A x1, 2.54mm pin x2

– MicroSD Slot x1

– MicroUSB: OTG and power input

(其他的配置信息请参考:http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO/zh)

(图片来自:http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO/zh)

  • 操作系统

NanoPi NEO支持多个类型的系统,包含基于ubuntu 16.04 的FriendlyCore系统,OpenWrt系统,DietPi, Armbian及Android系统。

目前安装的系统为FriendlyCore系统(nanopi-neo_sd_friendlycore-xenial_4.14_armhf_20190522.img.zip),可以从这里下载:http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO/zh#.E5.AE.89.E8.A3.85.E7.B3.BB.E7.BB.9F

  • bootloader – uboot

首先当然是看一下bootloader的启动信息:

可以看到,这是NanoPi NEO只有256M内存。我们再看一下uboot的环境变量:

=> printenv
arch=arm
baudrate=115200
board=nanopi-neo
board_name=sunxi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdti
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_mmc=0
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 mmc_auto usb0 pxe dhcp 
bootcmd=fatload mmc 0:1 ${scriptaddr} boot.scr; source ${scriptaddr}
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;
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_mmc1=setenv devnum 1; run mmc_boot
bootcmd_mmc_auto=run bootcmd_mmc0
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
bootm_size=0xa000000
console=ttyS0,115200
cpu=h3
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/
ethaddr=02:81:60:d6:75:38
fdt_addr_r=0x43000000
fdtcontroladdr=4bf4fe68
fdtfile=sun8i-h3-nanopi-m1-plus.dtb
kernel_addr_r=0x42000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
mac_node=[2 81 60 d6 75 38]
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
mmc_bootdev=0
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;
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} bootfe
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} ${e
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_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 FAIe
scriptaddr=0x43100000
serial#=02c0018160d67538
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
wifi_mac_node=[2 38 75 d6 60 81]

Environment size: 4375/131068 bytes
=> 

由`fdtfile=sun8i-h3-nanopi-m1-plus.dtb’, 我们可以猜想到这个bootloader其实是给NanoPI M1 Plus(http://wiki.friendlyarm.com/wiki/index.php/NanoPi_M1_Plus)用的,在后面下载编译uboot的时候,也证实了这一点。

由于NanoPi Neo与NanoPi M1 Plus的配置是不一样的,也导致了这个loader无法使用usbboot和netboot:

– usbboot:

=> run bootcmd_usb0 
starting USB...
No controllers found
USB is stopped. Please issue 'usb start' first.

– netboot

=> run bootcmd_dhcp 
starting USB...
No controllers found
No ethernet found.
No ethernet found.
  • 源代码

参考:http://wiki.friendlyarm.com/wiki/index.php/Building_U-boot_and_Linux_for_H5/H3/H2%2B/zh

交叉编译工具链使用的是Android项目源码中的工具链:

pie-9.0.0_r8/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel-

uboot源代码:

$ git clone https://github.com/friendlyarm/u-boot.git -b sunxi-v2017.x
commit 1ee53f5cff60d4daf9e5b49873932c454d53383a
Author: wuweidong <625769020@qq.com>
Date:   Mon Mar 4 15:58:22 2019 +0800

    sunxi: nanopi-h3: Always load boot.scr from mmc 0:1

编译:

$ apt-get install swig python-dev python3-dev
$ cd u-boot
$ ARCH=arm CROSS_COMPILE=/data/PUB-pie-9.0.0_r8/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel- make nanopi_neo_defconfig
$ ARCH=arm CROSS_COMPILE=/data/PUB-pie-9.0.0_r8/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel- make -j 6

注:这里我们不再使用nanopi_h3_defconfig,而改用nanopi_neo_defconfig

kernel (4.14)源代码:

$ git clone https://github.com/friendlyarm/linux.git -b sunxi-4.14.y
commit f196613327e082ff6cd4f269209b243eddf6fa85
Author: wuweidong <625769020@qq.com>
Date:   Wed May 22 09:50:06 2019 +0800

    cpufreq: Decrease sample rate for allwinner-h3

编译:

$ cd linux
$ ARCH=arm CROSS_COMPILE=/data/PUB-pie-9.0.0_r8/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel- make sunxi_defconfig
$ ARCH=arm CROSS_COMPILE=/data/PUB-pie-9.0.0_r8/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel- make -j 6
  • 相关的参考文档:
  1. http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO/zh
  2. http://wiki.friendlyarm.com/wiki/index.php/Building_U-boot_and_Linux_for_H5/H3/H2%2B/zh

《Others: 由FriendlyElec出品的NanoPi NEO》有2个想法

  1. hi

    看了下你的blog, 感觉很有意思, 很多东西都和我们做的类似。
    不知道你现在从事什么工作? 方便用其他聊天工具沟通一下吗?
    希望以后可以在工作或技术上多多交流。
    可以邮件沟通。

发表评论

电子邮件地址不会被公开。 必填项已用*标注