NetBSD Cross-Compilation

usefull in both situations:

so let’s get the kernel sources

ver=3.1.1

ftp -a ftp://ftp.netbsd.org/pub/NetBSD-archive/NetBSD-$ver/source/sets/syssrc.tgz

on top of syssrc, you also need src share gnusrc

ftp -a ftp://ftp.netbsd.org/pub/NetBSD-archive/NetBSD-$ver/source/sets/src.tgz
ftp -a ftp://ftp.netbsd.org/pub/NetBSD-archive/NetBSD-$ver/source/sets/sharesrc.tgz
ftp -a ftp://ftp.netbsd.org/pub/NetBSD-archive/NetBSD-$ver/source/sets/gnusrc.tgz
progress -zf src.tgz tar xf -
progress -zf sharesrc.tgz tar xf -
progress -zf gnusrc.tgz tar xf -
cd usr/src/

TWEAKING

cd /usr/src/sys/arch/i386/conf
cp DISKLESS LESSPLUS
cat >> LESSPLUS <<-EOF
nfe*    at pci? dev ? function ?        # NVIDIA nForce Ethernet
#viaide*         at pci? dev ? function ?        # VIA/AMD/Nvidia IDE controllers
EOF

COMPILATION

e.g. i386 on amd64 (and if same arch, it does not harm),

time sh build.sh -m i386 tools > /data/build/make.tools.log && echo done

then

cd /usr/src/
time sh build.sh -m i386 -T /usr/src/tooldir.NetBSD-8.0-i386/ kernel=LESSPLUS
#-u
#rm -rf /usr/src/sys/arch/i386/compile/obj/LESSPLUS
#rm -rf /usr/src/sys/arch/i386/compile/LESSPLUS

gzip -9 -c < /usr/src/sys/arch/i386/compile/obj/LESSPLUS/netbsd > ~/netbsd.LESSPLUS.gz

then fetch the thing,

scp root@10.1.1.99:~/netbsd.LESSPLUS.gz .

RESOURCES

TRASH / DOES NOT WORK

echo $kernel
cd /usr/src/sys/arch/`uname -m`/conf/
rm -rf ../compile/$kernel/
USETOOLS=yes /usr/src/tooldir.NetBSD-8.0-i386/bin/nbconfig $kernel
cd ../compile/$kernel/
USETOOLS=yes /usr/src/tooldir.NetBSD-8.0-i386/bin/nbmake -j16 depend > /data/build/make.depend.log && echo done
USETOOLS=yes /usr/src/tooldir.NetBSD-8.0-i386/bin/nbmake -j16 > /data/build/make.log && echo done

mv /usr/share/mk/bsd.sys.mk /usr/share/mk/bsd.sys.mk.dist 
ln -s /data/build/usr/src/share/mk/bsd.sys.mk /usr/share/mk/bsd.sys.mk 

TRASH / TROUBLESHOOTING

http://www.rafb.me/results/tkHbVe93.html ../../../../sys/lwp.h:181:12: error: inline function ‘lwp_suspend’ declared but never defined [-Werror]

https://mail-index.netbsd.org/current-users/2017/08/06/msg032150.html defined i386 otherwise it may ask for i486 gcc


Nethence | Doc | Pub | Lab | Pbraun | SNE Russia | xhtml