From f56a0a77abf33d57e9ee3c162107f6120de4df36 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Tue, 28 Apr 2015 17:15:59 +0200 Subject: [PATCH 1/5] New package: usbarmory-base-1.0 --- srcpkgs/usbarmory-base/INSTALL | 9 +++++++ srcpkgs/usbarmory-base/files/dhcpcd-usb0.conf | 5 ++++ srcpkgs/usbarmory-base/files/dhcpcd-usb0/run | 3 +++ srcpkgs/usbarmory-base/template | 26 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 srcpkgs/usbarmory-base/INSTALL create mode 100644 srcpkgs/usbarmory-base/files/dhcpcd-usb0.conf create mode 100755 srcpkgs/usbarmory-base/files/dhcpcd-usb0/run create mode 100644 srcpkgs/usbarmory-base/template diff --git a/srcpkgs/usbarmory-base/INSTALL b/srcpkgs/usbarmory-base/INSTALL new file mode 100644 index 0000000000..a0984d66e9 --- /dev/null +++ b/srcpkgs/usbarmory-base/INSTALL @@ -0,0 +1,9 @@ +case "$ACTION" in +post) + # enable sshd, ntpdate, ntpd and dhcpcd services. + mkdir -p etc/runit/runsvdir/default/ + ln -sf /etc/sv/sshd etc/runit/runsvdir/default/ + ln -sf /etc/sv/ntpd etc/runit/runsvdir/default/ + ln -sf /etc/sv/dhcpcd-usb0 etc/runit/runsvdir/default/ + ;; +esac diff --git a/srcpkgs/usbarmory-base/files/dhcpcd-usb0.conf b/srcpkgs/usbarmory-base/files/dhcpcd-usb0.conf new file mode 100644 index 0000000000..4f652367eb --- /dev/null +++ b/srcpkgs/usbarmory-base/files/dhcpcd-usb0.conf @@ -0,0 +1,5 @@ +# Static IP configuration. +interface usb0 +static ip_address=10.0.0.1 +static routers=10.0.0.2 +static domain_name_servers=8.8.8.8 8.8.4.4 diff --git a/srcpkgs/usbarmory-base/files/dhcpcd-usb0/run b/srcpkgs/usbarmory-base/files/dhcpcd-usb0/run new file mode 100755 index 0000000000..15576af017 --- /dev/null +++ b/srcpkgs/usbarmory-base/files/dhcpcd-usb0/run @@ -0,0 +1,3 @@ +#!/bin/sh +[ -r conf ] && . ./conf +exec dhcpcd ${OPTS:=-f /etc/dhcpcd-usb0.conf} 1>&2 diff --git a/srcpkgs/usbarmory-base/template b/srcpkgs/usbarmory-base/template new file mode 100644 index 0000000000..74657d0586 --- /dev/null +++ b/srcpkgs/usbarmory-base/template @@ -0,0 +1,26 @@ +# Template file for 'usbarmory-base' +pkgname=usbarmory-base +version=1.0 +revision=1 +homepage="http://www.voidlinux.eu" +short_desc="Void Linux USBarmory base files" +maintainer="Enno Boland " +license="Public Domain" + +only_for_archs="armv7l" +depends="virtual?ntp-daemon usbarmory-u-boot usbarmory-kernel" + +do_install() { + # load LED, CI HDRC i.MX USB binding, and g_ether driver + vmkdir usr/lib/modules-load.d + for m in ledtrig_heartbeat ci_hdrc_imx; do + echo "$m" > ${DESTDIR}/usr/lib/modules-load.d/${m%% *}.conf + done + cat > ${DESTDIR}/usr/lib/modules-load.d/g_ether.conf < Date: Tue, 28 Apr 2015 17:16:05 +0200 Subject: [PATCH 2/5] New package: usbarmory-kernel-4.0.0 --- srcpkgs/usbarmory-kernel-headers | 1 + srcpkgs/usbarmory-kernel/template | 154 ++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 120000 srcpkgs/usbarmory-kernel-headers create mode 100644 srcpkgs/usbarmory-kernel/template diff --git a/srcpkgs/usbarmory-kernel-headers b/srcpkgs/usbarmory-kernel-headers new file mode 120000 index 0000000000..5ef7c3f012 --- /dev/null +++ b/srcpkgs/usbarmory-kernel-headers @@ -0,0 +1 @@ +usbarmory-kernel \ No newline at end of file diff --git a/srcpkgs/usbarmory-kernel/template b/srcpkgs/usbarmory-kernel/template new file mode 100644 index 0000000000..1236bc466f --- /dev/null +++ b/srcpkgs/usbarmory-kernel/template @@ -0,0 +1,154 @@ +# Template file for 'usbarmory-kernel' +pkgname=usbarmory-kernel +version=4.0.0 +revision=1 +_configrev=396c9d07c859f9c763df042756ccc288b66e1a99 +wrksrc="linux-${version%.*}" +maintainer="Enno Boland " +homepage="http://inversepath.com/usbarmory" +license="GPL-2" +short_desc="The Linux kernel and modules for the Inversepath USB armory" +distfiles="${KERNEL_SITE}/kernel/v4.x/linux-${version%.*}.tar.xz + https://github.com/inversepath/usbarmory/archive/$_configrev.tar.gz" +checksum="0f2f7d44979bc8f71c4fc5d3308c03499c26a824dd311fdf6eef4dee0d7d5991 + 0c5e5a0f8ae5225afb85c43c4f3738311e3d3da7f6c41cb6e4d6564d28574fe3" + +nodebug=yes +nostrip=yes +noverifyrdeps=yes +noshlibprovides=yes + +only_for_archs="armv7l" +hostmakedepends="perl kmod uboot-mkimage libressl-openssl bc" +makedepends="ncurses-devel" +triggers="kernel-hooks" + +_kernver="${version}_${revision}" +# These files could be modified when an external module is built. +mutable_files=" + /usr/lib/modules/${_kernver}/modules.builtin.bin + /usr/lib/modules/${_kernver}/modules.softdep + /usr/lib/modules/${_kernver}/modules.dep + /usr/lib/modules/${_kernver}/modules.dep.bin + /usr/lib/modules/${_kernver}/modules.symbols + /usr/lib/modules/${_kernver}/modules.symbols.bin + /usr/lib/modules/${_kernver}/modules.alias + /usr/lib/modules/${_kernver}/modules.alias.bin + /usr/lib/modules/${_kernver}/modules.devname" + +do_configure() { + cp $XBPS_BUILDDIR/usbarmory-$_configrev/software/kernel_conf/usbarmory_linux-${version%.*}.config .config + cp $XBPS_BUILDDIR/usbarmory-$_configrev/software/kernel_conf/imx53-usbarmory* arch/arm/boot/dts + + # Always use our revision to CONFIG_LOCALVERSION to match our pkg version. + sed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config +} +do_build() { + if [ "$CROSS_BUILD" ]; then + _args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-" + fi + make ${makejobs} ${_args} ARCH=arm prepare + make ${makejobs} ${_args} ARCH=arm uImage LOADADDR=0x70008000 modules imx53-usbarmory.dtb +} +do_install() { + local hdrdest + + # Run depmod after compressing modules. + sed -i '2iexit 0' scripts/depmod.sh + + # Install kernel, firmware and modules + make ${makejobs} ARCH=arm INSTALL_MOD_PATH=${DESTDIR} modules_install + + vmkdir boot + mv arch/arm/boot/uImage ${DESTDIR}/boot + mv arch/arm/boot/dts/imx53-usbarmory.dtb ${DESTDIR}/boot + + hdrdest=${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver} + + # Switch to /usr. + vmkdir usr + mv ${DESTDIR}/lib ${DESTDIR}/usr + + cd ${DESTDIR}/usr/lib/modules/${_kernver} + rm -f source build + ln -sf ../../../src/${sourcepkg}-headers-${_kernver} build + + cd ${wrksrc} + # Install required headers to build external modules + install -Dm644 Makefile ${hdrdest}/Makefile + install -Dm644 kernel/Makefile ${hdrdest}/kernel/Makefile + install -Dm644 .config ${hdrdest}/.config + mkdir -p ${hdrdest}/include + + # Remove firmware stuff provided by the "linux-firmware" pkg. + rm -rf ${DESTDIR}/usr/lib/firmware + + for i in acpi asm-generic config crypto drm generated linux math-emu \ + media net pcmcia scsi sound trace uapi video xen; do + [ -d include/$i ] && cp -a include/$i ${hdrdest}/include + done + + cd ${wrksrc} + # Copy files necessary for later builds. + cp Module.symvers ${hdrdest} + cp -a scripts ${hdrdest} + + # fix permissions on scripts dir + chmod og-w -R ${hdrdest}/scripts + + # copy arch includes for external modules + mkdir -p ${hdrdest}/arch/arm/mach-imx + cp -a arch/arm/include ${hdrdest}/arch/arm + + mkdir -p ${hdrdest}/arch/arm/kernel + + cp arch/arm/Makefile ${hdrdest}/arch/arm + cp arch/arm/kernel/asm-offsets.s ${hdrdest}/arch/arm/kernel + + # Add docbook makefile + install -Dm644 Documentation/DocBook/Makefile \ + ${hdrdest}/Documentation/DocBook/Makefile + + # Add md headers + mkdir -p ${hdrdest}/drivers/md + cp drivers/md/*.h ${hdrdest}/drivers/md + + # Add inotify.h + mkdir -p ${hdrdest}/include/linux + cp include/linux/inotify.h ${hdrdest}/include/linux + + # Add wireless headers + mkdir -p ${hdrdest}/net/mac80211/ + cp net/mac80211/*.h ${hdrdest}/net/mac80211 + + # Copy in Kconfig files + for i in $(find . -name "Kconfig*"); do + mkdir -p ${hdrdest}/$(echo $i | sed 's|/Kconfig.*||') + cp $i ${hdrdest}/$i + done + + # Remove unneeded architectures + for arch in alpha arm26 avr32 blackfin cris frv h8300 \ + ia64 m* p* s* um v850 x86 xtensa; do + rm -rf ${hdrdest}/arch/${arch} + done + + # Compress all modules with xz to save a few MBs. + msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n" + find ${DESTDIR} -name '*.ko' | xargs -n1 -P0 gzip -9 + + # ... and run depmod again. + depmod -b ${DESTDIR}/usr -F System.map ${_kernver} +} + +usbarmory-kernel-headers_package() { + nostrip=yes + noverifyrdeps=yes + noshlibprovides=yes + replaces="kernel-rpi-headers>=0" + short_desc="The Linux kernel headers for the Inversepath USB armory" + pkg_install() { + vmove usr/src + vmove usr/lib/modules/${_kernver}/build + } +} From 71cddadfd56ed51d8efff142a898c6a53035c9a5 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Tue, 28 Apr 2015 17:16:08 +0200 Subject: [PATCH 3/5] New package: usbarmory-u-boot-2015.04 --- srcpkgs/usbarmory-u-boot/template | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 srcpkgs/usbarmory-u-boot/template diff --git a/srcpkgs/usbarmory-u-boot/template b/srcpkgs/usbarmory-u-boot/template new file mode 100644 index 0000000000..f579f12661 --- /dev/null +++ b/srcpkgs/usbarmory-u-boot/template @@ -0,0 +1,33 @@ +# Template file for 'usbarmory-uboot' +pkgname=usbarmory-u-boot +version=2015.04 +revision=1 +wrksrc="u-boot-$version" +hostmakedepends="uboot-mkimage" +short_desc="USB armory U-Boot files for SD booting" +maintainer="Enno Boland " +license="GPL-2" +homepage="https://github.com/hardkernel/u-boot" +distfiles="http://ftp.denx.de/pub/u-boot/u-boot-$version.tar.bz2" +checksum="0a1a70df586655f527befa6f12e184e96ed61b126e5a567382321b17200f5d60" + +only_for_archs="armv7l" + +do_configure() { + make distclean + make usbarmory_config +} + +do_build() { + unset CFLAGS CXXFLAGS LDFLAGS + + if [ "$CROSS_BUILD" ]; then + make ARCH=arm CROSS_COMPILE=${XBPS_CROSS_TRIPLET}- + else + make ARCH=arm + fi +} + +do_install() { + vinstall u-boot.imx 600 boot +} From 23726bc9133d61fe067afccc88cd8f24fed0a60c Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Wed, 29 Apr 2015 16:21:59 +0200 Subject: [PATCH 4/5] usbarmory-kernel: remove obsolete replaces field --- srcpkgs/usbarmory-kernel/template | 1 - 1 file changed, 1 deletion(-) diff --git a/srcpkgs/usbarmory-kernel/template b/srcpkgs/usbarmory-kernel/template index 1236bc466f..70c5a3e6a1 100644 --- a/srcpkgs/usbarmory-kernel/template +++ b/srcpkgs/usbarmory-kernel/template @@ -145,7 +145,6 @@ usbarmory-kernel-headers_package() { nostrip=yes noverifyrdeps=yes noshlibprovides=yes - replaces="kernel-rpi-headers>=0" short_desc="The Linux kernel headers for the Inversepath USB armory" pkg_install() { vmove usr/src From ff548f0e72521d1f1735b297d48f8ca3666fff44 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Wed, 29 Apr 2015 16:28:44 +0200 Subject: [PATCH 5/5] usbarmory-base: move options to modprobe.d --- srcpkgs/usbarmory-base/template | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/srcpkgs/usbarmory-base/template b/srcpkgs/usbarmory-base/template index 74657d0586..c2d2fc01c2 100644 --- a/srcpkgs/usbarmory-base/template +++ b/srcpkgs/usbarmory-base/template @@ -13,13 +13,11 @@ depends="virtual?ntp-daemon usbarmory-u-boot usbarmory-kernel" do_install() { # load LED, CI HDRC i.MX USB binding, and g_ether driver vmkdir usr/lib/modules-load.d - for m in ledtrig_heartbeat ci_hdrc_imx; do + vmkdir usr/lib/modprobe.d + echo 'options g_ether use_eem=0 dev_addr=1a:55:89:a2:69:41 host_addr=1a:55:89:a2:69:42' > ${DESTDIR}/usr/lib/modprobe.d/g_ether.conf + for m in ledtrig_heartbeat ci_hdrc_imx g_ether; do echo "$m" > ${DESTDIR}/usr/lib/modules-load.d/${m%% *}.conf done - cat > ${DESTDIR}/usr/lib/modules-load.d/g_ether.conf <