Networking Tools » README_ifplugd_0.28.md
Cross-compiling ifplugd → opkg .ipk (MityDSP-L138, Angstrom OE 2012.05)
Builds ifplugd 0.28 for ARMv5te and packages it as ifplugd_0.28-r0_armv5te.ipk.
Requires the OE 2012.05 SDK installed at /usr/local/oecore-x86_64.
libdaemon is already in the SDK sysroot, so ifplugd links against it dynamically.
# 1. Source the toolchain (every build shell)
# https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/GCC_Toolchain
source /usr/local/oecore-x86_64/environment-setup-armv5te-angstrom-linux-gnueabi
# 2. Clone
git clone --depth 1 https://github.com/andrewshadura/ifplugd.git
cd ifplugd
# 3. Build
autoreconf -fi
# stub the SVN-generated version header (absent in a git checkout)
printf '#ifndef foosvnrevisionhfoo\n#define foosvnrevisionhfoo\n#define SVN_REVISION "0.28-git"\n#endif\n' > src/svn-revision.h
# --sbindir=/sbin installs the binaries to /sbin and makes the generated
# init script (conf/ifplugd.init from @sbindir@) point there to match
./configure $CONFIGURE_FLAGS --prefix=/usr --sysconfdir=/etc --sbindir=/sbin --disable-lynx
make # the man/ target fails (no lynx) — expected; binaries build in src/
# 4. Stage + strip
export DESTDIR=$PWD/ipk-root && rm -rf "$DESTDIR"
make -C src install DESTDIR="$DESTDIR"
make -C conf install DESTDIR="$DESTDIR"
arm-angstrom-linux-gnueabi-strip "$DESTDIR"/sbin/ifplugd "$DESTDIR"/sbin/ifplugstatus
# 5. Package
mkdir -p ipk-build/control && cd ipk-build
cat > control/control <<'EOF'
Package: ifplugd
Version: 0.28-r0
Architecture: armv5te
Maintainer: jcormier@criticallink.com
Section: net
Priority: optional
Depends: libdaemon (>= 0.5)
Description: Link-state network interface plug detection daemon
EOF
cat > control/conffiles <<'EOF'
/etc/ifplugd/ifplugd.conf
/etc/ifplugd/ifplugd.action
EOF
# postinst: enable the init script and start the daemon
# ($D handles offline installs into an image rootfs — register only)
cat > control/postinst <<'EOF'
#!/bin/sh
if [ -n "$D" ]; then
OPKG_OFFLINE_ROOT="$D" update-rc.d -r "$D" ifplugd defaults
exit 0
fi
update-rc.d ifplugd defaults
/etc/init.d/ifplugd start
exit 0
EOF
# prerm: stop the daemon and remove the rc.d links on uninstall
cat > control/prerm <<'EOF'
#!/bin/sh
/etc/init.d/ifplugd stop
update-rc.d -f ifplugd remove
exit 0
EOF
chmod 0755 control/postinst control/prerm
echo "2.0" > debian-binary
tar --owner=0 --group=0 -czf control.tar.gz -C control ./control ./conffiles ./postinst ./prerm
tar --owner=0 --group=0 -czf data.tar.gz -C "$DESTDIR" ./etc ./sbin
ar -rc ifplugd_0.28-r0_armv5te.ipk debian-binary control.tar.gz data.tar.gz
Install on target: opkg install ifplugd_0.28-r0_armv5te.ipk
The postinst enables the init script and starts ifplugd immediately;
prerm stops it and removes the boot links on uninstall.
- « Previous
- 1
- 2
- 3
- 4
- Next »