Skip to content

Commit e35e579

Browse files
committed
build_mdio: add script for building userspace binary of mdio tool
kernel-module has to be build separately with passing kernel source in kernel-dir of mdio-tool working copy: KDIR=/media/data_ext/git/kernel/BPI-Router-Linux ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make all
1 parent fe99533 commit e35e579

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

build_mdio.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# mdio-tools need kernel-module built before
4+
# first build kernel itself to have necesary files there
5+
# cd kernel/; KDIR=kernel-dir ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make all
6+
7+
# copy script in the root-filesystem "cp build_mdio.sh $rootdir/root/"
8+
# chroot $rootdir /root/build_mdio.sh
9+
10+
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/. 2>/dev/null)" ]; then
11+
echo "We are chrooted! continue building..."
12+
13+
apt update
14+
apt -y install git gcc make
15+
apt install autoconf pkg-config libmnl0 libmnl-dev file
16+
cd /usr/src
17+
git clone https://github.com/wkz/mdio-tools.git
18+
cd mdio-tools/
19+
./autogen.sh
20+
#make
21+
PRFX=$(pwd)/install
22+
#make PREFIX=$PRFX SBINDIR=$PRFX/sbin install
23+
LDFLAGS=-static ./configure --prefix=$PRFX/usr && make all && make install
24+
#./configure --prefix=$PRFX/usr && make all && sudo make install
25+
#file src/mdio/mdio
26+
cd $PRFX
27+
tar -czf ../mdio-tools.tar.gz .
28+
tar -tzf ../mdio-tools.tar.gz
29+
else
30+
echo "no chroot...exiting..."
31+
fi

0 commit comments

Comments
 (0)