By default, eth0 is disabled on BPI ZERO M2.
Here we will show to enable it
The solution is to create a dtdo file and place it in right place.
1: Create a text source file: bananapi-m2-zero-eth0.dts
/dts-v1/;
/plugin/;
/ {
model = "Banana Pi BPI-M2-Zero";
compatible = "sinovoip,bpi-m2-zero\0allwinner,sun8i-h2-plus";
/*
* enable onboard eth0 on Banana PI M2 ZERO
* which is disabled by default
* bontango 08.2022
*
* compile with
* dtc -I dts -O dtb -o bananapi-m2-zero-eth0.dtbo bananapi-m2-zero-eth0.dts
* move bananapi-m2-zero-eth0.dtbo to /boot/overlay-user
* add line "user_overlays=bananapi-m2-zero-eth0" to /boot/armbianEnv.txt
*/
fragment@0 {
target-path = "/aliases";
__overlay__ {
ethernet0 = "/soc/ethernet@1c30000";
};
};
fragment@1 {
target = <&emac>;
__overlay__ {
status = "okay";
phy-handle = <&int_mii_phy>;
phy-mode = "mii";
allwinner,leds-active-low;
};
};
};
2: Use dtc tool to compile source file:
dtc -I dts -O dtb -o bananapi-m2-zero-eth0.dtbo bananapi-m2-zero-eth0.dts
3: create subdirectory into /boot as root
cd /boot ; mkdir overlay-user ; cd -
4: place the binary file (dtbo) into user_overlays:
mv bananapi-m2-zero-eth0.dtbo overlay-user
5: enable overlay into armbianEnv.txt (without .dtbo extension !!!)
echo "user_overlays=bananapi-m2-zero-eth0" >> /boot/armbianEnv.txt
6: reboot (and thank bontango (https://forum.banana-pi.org/) for his help)
Apply this wiring and connect your BPI on your LAN.
Component are:
RJ2 socket from LCSC: DS1128-09-S8B8X
CN1 from LCSC: A2005HWV-2x2P
It works under "Armbian 21.05.1 Focal with Linux 5.15.48-sunxi"