[BPI-R2 new image] debian 10 buster image with Kernel 4.19.62

How to stop get random mac on every boot? Because my provider want me to have static MAC to enter network and then I need to get DHCP IP address. I have these lines in /etc/network/interfaces

auto wan allow-hotplug wan iface wan inet dhcp hwaddress ether 6c:3b:6b:48:b7:8c

but problem is that it try to obtain IP from DHCP before these lines applied and of course no internet connection until I manually ssh to box and run - dhclient wan. After it - all goes well.

You can set mac in dts (need to recompile kernel or using separated dtb)

Afaik there is no BIA (or at least we don’t know how to access it) so it have to be set manually

I’m new to this. Is there step by step guide how to do this from scratch?

Just google and correct me if I wrong:

first i use this command to convert dtb from binary to text

dtc -I dtb -O dts bpi-r2.dtb > bpi-r2.dts

then I need to edit this file bpi-r2.dts and add needed mac to section

        mac@1 {
                compatible = "mediatek,eth-mac";
                reg = < 0x01 >;
                phy-mode = "trgmii";
                phandle = < 0x50 >;

                fixed-link {
                        speed = < 0x3e8 >;
                        full-duplex;
                        pause;
                };
        };

so it looks like

            mac@1 {
                    compatible = "mediatek,eth-mac";
                    reg = < 0x01 >;
                    phy-mode = "trgmii";
                    mac-address = [ 02 02 02 02 02 02 ];
                    phandle = < 0x50 >;

                    fixed-link {
                            speed = < 0x3e8 >;
                            full-duplex;
                            pause;
                    };
            };

and then compile it with command

dtc -O dtb -o bpi-r2-new.dtb bpi-r2.dts

then I just backup old bpi-r2.dtb and put newly compiled file to /boot/bananapi/bpi-r2/linux/dtb/ with the name bpi-r2.dtb

Just clone my repo change the dts and compile full kernel…else you need to setup uboot to use kernel without dtb and separate dtb…

Just clone my repo change the dts and compile full kernel

need step-by-step instructions for it

also can’t I just decompile dts file, make changes and compilte it with replacing file?

My image using (like the other images) dtb inside kernel-binary so just build full kernel…

git clone https://github.com/frank-w/BPI-R2-4.14
cd BPI-R2-4.14
git checkout 4.19-main
./build.sh dts
./build.sh importconfig
./build.sh

When installing to Sdcard use name uImage (just remove version info).else you need to change uenv.txt

What file do I need to edit to add mac to wan interface?

p.s. I see file bpi-r2-mac.dts in root of kernel source but can’t understand how to specify wan or eth1 iface.

p.s.s this one:

arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts

?

p.s.s.s oooohhh just runned command ./build.sh dts and opened text editor :wink: compiling it now, let’s see what’s happen.

this file is an example for devicetree-overlay, but you have to configure uboot to use separate dts and this overlay which is not trivial, so as a start just change the dts itself which is the easiest way

this is how it looks in 4.14:

gmac0: mac@0 {
    compatible = "mediatek,eth-mac";
    reg = <0>;
    phy-mode = "trgmii";
    mac-address = [02 02 02 02 02 02];

    fixed-link {
        speed = <1000>;
        full-duplex;
        pause;
    };
};

gmac1: mac@1 {
    compatible = "mediatek,eth-mac";
    reg = <1>;
    phy-mode = "trgmii";
    mac-address = [02 03 03 03 03 03];

    fixed-link {
        speed = <1000>;
        full-duplex;
        pause;
    };
};

gmac0=lan,gmac1=wan

in 4.19 i had only defined lan, just copy the property to gmac1 and change mac-address

then compile and install your kernel to sdcard

also need to add ethernet1 to alias section?

no, only add the

mac-address

property to the gmac you want with the mac-address in the format above…alias is also only needed for dto

edit: have added it now also in 4.19 so you can also use package created by travis if build is complete

@sHAsHiLx have you got it working?

Yes, compiled on x86 linux and booted success. Also found that your kernel lacks some module to get pptp vpn to work - ppp_async so edited .config file and recompiled it again. May be you can put this in your debian buster distro by default? Also interesting for which purposes - eth0/eth1? First I was think I can give eth0 local IP and all lanX interfaces will reply to this IP… but no… was make br0 and put all lanX interfaces to it…

just say me the config-options needed…i don’t wanted an all-yes-config so i activated only the options needed by me and the people reported options to me. but this is kernel-related, not image-related.

eth0/eth1 are the (internal) cpu-ports between SOC and Switch, lanX/wan are the (physical/external) dsa-ports of the switch where you put your rj45-jack in. CPU-POrts have to only be set “up” without any other config. IP-configuration has to be done on dsa-ports (lanx). if all lan-ports need to be in same lan-segment, they have to be bridged and get 1 IP-address. if you use different lan-segments (like me) you can give any lan-port another IP-adress

Yes, need all lan ports to be in one network like other router this do out-of-box. I don’t ask about all-yes but CONFIG_SOME_MODULE=m - will be great and slim and don’t need to waste hour time to google - what the heck is logs says and found that it need module that not present…

p.s. also found if I choose deb package on kernel compile - it give kernel wrong names. If I choose pack - all names correct.

for bridge, i have wrote an example here: https://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/network/start#netbridge

everybody needs another “some_module” :wink: and figuring out which module can be needed by somebody and its depencies will waste my time :wink: it is a basic kernel where everyone can add stuff he needs :wink: and maybe tell me what’s needed additional to it. but i don’t want to add modules/builtin-function nobody needs

for naming-issue you mean the file of deb/tar.gz? or inside the file?

deb is designed to install multiple kernels so the uImage has the version-number appended and change uEnv.txt on install

for naming-issue you mean the file of deb/tar.gz? or inside the file?

inside. because deb is simplier way to install and tar.gz file need to be unpacked manually to corresponding folders. don’t know for which reason this is because system have mounted boot and root folders - why not make same structure in tar.gz file… or may be some script with these BPI2-BOOT BPI2-ROOT folders that rename files/folders to some old…

not all systems have boot-partition mounted in /boot, so i have separated this in tar.gz-file, there are only 2 commands to unpack the tar.gz-file. tar.gz-file is designed to be installed in running system, but outside where root/boot are mounted anywhere. deb is designed to be installed in running system, so it points to / and /boot instead of BPI-BOOT/BPI-ROOT

sudo tar -xzf ${kernelpack} -C / --strip-components=1 BPI-ROOT
sudo tar -xzf ${kernelpack} -C /boot/ --strip-components=1 BPI-BOOT

just fork my repo and do changes you think and i take a look over it…

btw. this discussion is more kernel-related and should be placed in a new thread…

What is the source for this preloader? Have you got any URLs for it or something? I want to test it in case it wasn’t covered in this thread.

Hello,

I think here you can find the sources for this preloader from BPI: https://github.com/BPI-SINOVOIP/BPI-files/tree/master/SD/100MB.

There are 2 files there: BPI-R2-preloader-DDR1600-20190722-2k.img.gz and BPI-R2-EMMC-boot0-DDR1600-20190722-0k.img.gz which were commited to the repository 21 days ago.