Creating a current armbian-Image with network-fix
#1
I recently got my sopine modules and my clusterboard only to notice that the network is not working. So I searched the forums and found a way to conveniently build an Armbian-Image which has the network fix applied (using Ubuntu):

I tested this with the current Armbian Focal release.

Thanks to @AZClusterboard  who made an initial guide on how to setup the clusterboard which gave me confidence to buy my own cluster!

Step [b]Overview:[/b]

  1. Download current Armbian Focal release
  2. Mount the Image to make modifications
  3. Make changes to the .dtb file (allwinner network fix)
  4. Write the changed Image to as many sopines as you wish
  5. (Give each sopine a unique hostname by hand)

Step number 5 is not necessary but it helps in identifying sopine modules by name. So you can boot all modules at once, look at a "nmap" printout and can see each hostname and the corresponding ip-adress.

More thorough explanation of the steps:

1. Download current Armbian Focal release (https://www.armbian.com/sopine-a64/)

2. Mount the Image to make modifications (more informations here)

2.1. create a dir to mount the image to: e.g.

Code:
sudo mkdir /mnt/img

2.2. find the location of the partition within the image


Code:
fdisk -l <armbian-image.img>
This command gives you an overview about the image: Important are 2 things: sector-size (512 byte in my case) and beginning of the partition (sector 8192 in my case). The product is

Code:
512 bytes/sector * 8292 sectors =4194304 bytes
We need this number to correctly mound the image in the next step.

2.3. mound the image at the correct sector to the created directory in /mnt/img

Code:
sudo mount -o loop,rw,sync,offset=4194304 <armbian-image.img> /mnt/img
The image is now mounted with read and write permissions. Every change we do to the image will remain


3. Make changes to the .dtb file

3.1. navigate to the correct .dtb file

Code:
cd /mnt/img/boot/dtb/allwinner/

3.2. Now we need to translate the .dtb file. To do so we change it into a modifiable state using dtc. The file we want to change is sun50i-a64-sopine-baseboard.dtb (see here). I will name this modifiable file "temp.dts". This command will most likely throw some warnings but it will work.

Code:
sudo dtc -I dtb -O dts -o temp.dts sun50i-a64-sopine-baseboard.dtb

3.3. apply the fix to temp.dts described here

Code:
sudo nano temp.dts

go to the segment

Code:
ethernet@1c30000

and add

Code:
allwinner,tx-delay-ps = <500>;

as described here [LINK]

It will then look similar to 

Code:
                ethernet@1c30000 {
                        compatible = "allwinner,sun50i-a64-emac";
                        syscon = <0x2d>;
                        reg = <0x1c30000 0x10000>;
                        interrupts = <0x0 0x52 0x4>;
                        interrupt-names = "macirq";
                        resets = <0x2 0xd>;
                        reset-names = "stmmaceth";
                        clocks = <0x2 0x24>;
                        clock-names = "stmmaceth";
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x2e>;
                        phy-mode = "rgmii";
                        phy-handle = <0x2f>;
                        phy-supply = <0x30>;
                        phandle = <0x6f>;
                        allwinner,tx-delay-ps = <500>;

                        mdio {
                                compatible = "snps,dwmac-mdio";
                                #address-cells = <0x1>;
                                #size-cells = <0x0>;
                                phandle = <0x70>;

                                ethernet-phy@1 {
                                        compatible = "ethernet-phy-ieee802.3-c22";
                                        reg = <0x1>;
                                        phandle = <0x2f>;
                                };
                        };
                };


3.3. translate the modified .dts to and .dtb file and overwrite the old(faulty) .dtb-file. This command will produce some warnings, but it will work.

Code:
sudo dtc -O dtb -o sun50i-a64-sopine-baseboard.dtb -b 0 temp.dts

3.4. remove the temp.dts

Code:
sudo rm temp.dts

3.5. unmount the image, go to your home directory first, so the unmount process is successful

Code:
cd ~/
sudo umount /mnt/img

4. The image is now ready to be  written to a sd-card!

5. To change the hostname of each "sd-card"
After the sd-card is written, mount the sd-card and navigate

Code:
cd etc/

and change 2 files:

[1]In hostname, specify a hostname (old one is most likely "pine64so") you like (probaly something like "master" or "worker1" or "worker2" ...),
[2] in hosts, change every entry with the old hostname to your new hostname.

Save the changes made to both files, unmount you sd-card, put it in the sopine-module, wait for it to boot (may take some minutes), login with "root" and "1234" and enjoy your cluster!

If you have any questions, comments or suggestions for improvement let me know!
  Reply
#2
Thanks a lot for creating this guide!

Edit: Anyone got a easy guide to network boot the 6 other modules from the first one and eMMC?
  Reply
#3
Any idea why this might not work with an emmc?

First it seems like I had a faulty SD, but with a new SD it works now. However my 128GB emmc installed the same way still doesn't seem to boot.
  Reply
#4
(08-15-2020, 07:26 AM)poVoq Wrote: Any idea why this might not work with an emmc?

I think booting from emmc needs a whole different procedure.
https://forum.pine64.org/showthread.php?tid=5549

I don't have an emmc module, so I can't test anything.
  Reply
#5
If anyone else is fighting with the Armbian forum and it doesn't load, here's the cached version:
https://webcache.googleusercontent.com/s...ne-module/

important bit:


Quote:Add
    allwinner,tx-delay-ps = <500>;
 
to the ethernet device and it works.  Continues to work when soPine is plugged into the baseboard instead of the clusterboard.
 
Detail on the more complex fix here: https://patchwork.ozlabs.org/patch/873752/
  Reply
#6
Thanks for this. I've translated this into steps for NixOS for those who need it

https://nixos.wiki/wiki/NixOS_on_ARM/PIN...d_Ethernet
  Reply
#7
This worked a treat for me :-) - thank you for providing the details. For those for which this may be relevant, it even works properly in WSL on a Windows machine (heresy, I know, but needs must).

Has a patch be submitted for the up-stream, so that updating does not break things?
  Reply
#8
Hi,

In order to make this a a little more update resistant, you might find the following script useful


Code:
#!/bin/bash

DTB_NAME=sun50i-a64-sopine-baseboard.dtb
DTB_PATH=/boot/dtb/allwinner
TMPFILE=/tmp/tmp.dts
NEWFILE=/tmp/new.dts

clean_up() {
        rm $TMPFILE $NEWFILE > /dev/null 2>&1
}

if [ ! -f $DTB_PATH/$DTB_NAME ]
then
        echo dtb file not found
        exit 999
fi


dtc -I dtb -O dts -o $TMPFILE $DTB_PATH/$DTB_NAME > /dev/null 2>&1
if [ $? != 0 ]
then
        echo Cannot extract dts from $DTB_PATH/$DTB_NAME
        exit 998
fi

retcode=0
grep 'allwinner,tx-delay-ps' $TMPFILE > /dev/null 2>&1
if [ $? != 0 ]
then
        sed -e '/ethernet@1c30000 {$/,/phandle = <0x88>;/!b;/phandle = <0x88>;/a\\t\t\tallwinner,tx-delay-ps = <500>;' $TMPFILE > $NEWFILE
        if [ $? != 0 ]
        then
                echo Could not update temporary DTS file
                retcode=997
        else
                dtc -O dtb -o $DTB_PATH/$DTB_NAME -b 0 $NEWFILE > /dev/null 2>&1
                if [ $? != 0 ]
                then
                        echo Could not create new dts file
                        retcode=996
                fi
        fi

else
        echo Fix already in place
fi

clean_up

exit $retcode

This will check whether the supplied update is in place, and, if not, apply it using SED.

How you use this is up to you - perhaps putting a call to it in rc.local... If the card boots, and the fix is not present then it will be applied and all should be well for the next boot.

If you want to test it first on a mounted image, simply adjust the value of DTB_PATH.

I hope that it is found useful, but use as your own risk, no guarantees of any sort etc etc
  Reply
#9
Some silly questions from my side as I am contemplating into buying a clusterboard with 7 "blades".
1. Didn't someone put a fixed image online to make things easier?
2. Is the fix not being procesed as part of the normal fixes tht should be applined to images? After all it seem such a small fix.

Regards, Hugo.
  Reply
#10
I think the problem might be that the normal break out board and the Pine64 SBC work slightly different from the Clusterboard and the Armbian image is made for those.
However following the above description really is quite easy and works well with my clusterboard. Sorry I don't think anyone uploaded the fixed image.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Sad Version/Date of last armbian build that came with network patches? Bazmundi 0 217 12-07-2023, 03:23 PM
Last Post: Bazmundi
  Clusterboard not getting IP address after network fix Norlark 14 12,269 08-30-2021, 05:00 PM
Last Post: poVoq
  ArchLinux Network Booting xblack86 2 3,818 02-25-2021, 08:42 AM
Last Post: xblack86
  Clusterboard Armbian aww 17 22,862 07-01-2020, 02:40 PM
Last Post: wayward83
  Network problems (actually bad power supply) Unkn0wn 14 17,298 12-01-2019, 10:02 AM
Last Post: venix1
  Armbian Bionic 4.19.y PigLover 1 2,593 02-02-2019, 02:30 PM
Last Post: mdmbc

Forum Jump:


Users browsing this thread: 1 Guest(s)