1 1
Hackbeere

OrangePi Zero Plus: ethernet in u-boot

Recommended Posts

Hello all,

The board has a 2MB NOR FLASH chip what would be enough for storing u-boot and booting the system over network. Unfortunately u-boot says there is no ethernet.

Is there anybody who knows how to enable ethernet on this or similar board like OPi PC2 or Nanopi NEO2?

Is it just a matter of configuration or is RTL8211E as PHY generally not supported on H5 chips?

Thank you very much for your help.

--DieHackbeere

Share this post


Link to post
Share on other sites
Want Armbian t-shirt or a cup?

Have a look at this topic:-

 

I did a patch myself to fix ethernet in u-boot on the Pine64-R18. I believe it's a problem with most of the sun50xi configuration files.

 

Share this post


Link to post
Share on other sites

@Hackbeere

 

In order to enable the network interface for the Nanopi Neo 2 in U-boot you have to take the following steps (works with Ubuntu):

 

1) Install the toolchain on a Host PC (Ubuntu)

2) Install some additional software

3) Install u-boot

4) Make changes to the nanopi neo2 dts file in order to add network capability in U-boot

5) Compile the changes

6) Update U-boot on the SD card for the Nanopi Neo 2

 

Here are some detailed working instructions:


Install toolchain on Host PC (Ubuntu)

sudo su
mkdir -p /opt/FriendlyARM/toolchain/
cd /root


Download gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz from friendlyarm to the current (/root) folder

 

tar -xf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt/FriendlyARM/toolchain/
export PATH=/opt/FriendlyARM/toolchain/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin:$PATH
export GCC_COLORS=auto
. ~/.bashrc

 

Install some additional software on Host PC (Ubuntu)

 

(as root)

apt-get install swig python-dev python3-dev -y
apt-get install device-tree-compiler -y
apt-get install gcc-arm-linux-gnueabihf -y

 

Download and Compile U-Boot with network support on Host PC

(as root)

cd /root
git clone https://github.com/friendlyarm/u-boot.git
cd u-boot
git checkout sunxi-v2017.x

nano arch/arm/dts/sun50i-h5-nanopi-neo2.dts

Add to the end

&emac {
        pinctrl-names = "default";
        pinctrl-0 = <&emac_rgmii_pins>;
        status = "okay";
        phy = <&phy1>;
        phy-mode = "rgmii";
        phy1: ethernet-phy@1 {
                reg = <0>;
        };
};

 

Compile

make nanopi_h5_defconfig CROSS_COMPILE=aarch64-linux-gnu-
make CROSS_COMPILE=aarch64-linux-gnu-

Update U-Boot on SD Card
 

Insert the SD card with the Nanopi Neo 2 official ROM / OS in the cardreader of the host-pc. Check with lsblk where the SD card is with for the Nanopi Neo 2 is located (e.g. sdb) Replace sdX in the following commands with the actual location of the Nanopi Neo 2SD card.
 

dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8
dd if=u-boot.itb of=/dev/sdX bs=1024 seek=40



After that you can put the SD card in the Nanopi Neo 2 and the ethernet interface will show up in U-boot.
 

Share this post


Link to post
Share on other sites

@Hackbeere

How to enable network support in u-boot for the Nano Pi Neo 2.

 

The instructions above use the FriendlyArm repo, the same can be achieved with mainline using a more recent version of u-boot, the procedure is slightly different and described below:
 

In order to enable the network interface for the Nanopi Neo 2 in U-boot you have to take the following steps (works with Ubuntu 18.04):

 

1) Install the toolchain on a Host PC (Ubuntu)

2) Install some additional software

3) Compile arm-trusted-firmware

3) Install u-boot

4) Make changes to the nanopi neo2 dts file in order to add network capability in U-boot

5) Compile u-boot with the changes

6) Update U-boot on the SD card for the Nanopi Neo 2

 

Here are some detailed working instructions:


Install toolchain on Host PC (Ubuntu)

sudo su
mkdir -p /opt/FriendlyARM/toolchain/
cd /root
wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
tar -xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz -C /opt/FriendlyARM/toolchain/
export PATH=/opt/FriendlyARM/toolchain/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin:$PATH
export GCC_COLORS=auto
. ~/.bashrc

 

Install additional software on Host PC (Ubuntu)

apt install gcc-aarch64-linux-gnu -y
apt install git make gcc bison flex -y
apt install swig python-dev python3-dev -y
apt install device-tree-compiler -y
apt install gcc-arm-linux-gnueabihf -y

 

Compile arm-trusted-firmware on Host PC

cd /root
git clone https://github.com/apritzel/arm-trusted-firmware.git
cd arm-trusted-firmware/
git checkout allwinner
export CROSS_COMPILE=aarch64-linux-gnu-
make PLAT=sun50iw1p1 DEBUG=1 bl31
export BL31=/root/arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin

 

Compile U-Boot with network support on Host PC

cd /root
git clone git://git.denx.de/u-boot.git u-boot/
cd u-boot

nano arch/arm/dts/sun50i-h5-nanopi-neo2.dts

Add to the end

&emac {
        pinctrl-names = "default";
        pinctrl-0 = <&emac_rgmii_pins>;
        status = "okay";
        phy = <&phy1>;
        phy-mode = "rgmii";
        phy1: ethernet-phy@1 {
                reg = <0>;
        };
};

Compile u-boot

make nanopi_neo2_defconfig CROSS_COMPILE=aarch64-linux-gnu-
make CROSS_COMPILE=aarch64-linux-gnu-

 

Update U-Boot on SD Card

Insert the SD card with the Nanopi Neo 2 official ROM / OS in the cardreader of the host-pc. Check with lsblk where the SD card is with for the Nanopi Neo 2 is located (e.g. sdb) Replace sdX in the following commands with the actual location of the Nanopi Neo 2 SD card.

dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8
dd if=u-boot.itb of=/dev/sdX bs=1024 seek=40
sync


I hope this helps.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
1 1