2015-12-02 20:33:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
|
|
|
|
#
|
|
|
|
# This file is licensed under the terms of the GNU General Public
|
|
|
|
# License version 2. This program is licensed "as is" without any
|
|
|
|
# warranty of any kind, whether express or implied.
|
|
|
|
#
|
|
|
|
# This file is a part of tool chain https://github.com/igorpecovnik/lib
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Create board support packages
|
|
|
|
#
|
2015-12-18 12:22:42 +03:00
|
|
|
# Functions:
|
|
|
|
# create_board_package
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
create_board_package (){
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# create .deb package for the rest
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
display_alert "Creating board support package." "$BOARD" "info"
|
|
|
|
|
|
|
|
if [[ $BRANCH == "next" ]]; then
|
|
|
|
ROOT_BRACH="-next";
|
|
|
|
else
|
|
|
|
ROOT_BRACH="";
|
|
|
|
fi
|
|
|
|
|
2016-03-14 21:54:03 +03:00
|
|
|
local destination=$DEST/debs/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_armhf
|
2015-12-02 20:33:32 +01:00
|
|
|
local controlfile=$destination/DEBIAN/control
|
|
|
|
|
|
|
|
mkdir -p $destination/DEBIAN
|
|
|
|
|
|
|
|
echo "Package: linux-$RELEASE-root$ROOT_BRACH-$BOARD" > $controlfile
|
|
|
|
echo "Version: $REVISION" >> $controlfile
|
|
|
|
echo "Architecture: armhf" >> $controlfile
|
|
|
|
echo "Maintainer: $MAINTAINER <$MAINTAINERMAIL>" >> $controlfile
|
|
|
|
echo "Installed-Size: 1" >> $controlfile
|
|
|
|
echo "Section: kernel" >> $controlfile
|
|
|
|
echo "Priority: optional" >> $controlfile
|
2016-01-21 23:09:53 +01:00
|
|
|
echo "Recommends: fake-hwclock" >> $controlfile
|
2015-12-02 20:33:32 +01:00
|
|
|
echo "Description: Root file system tweaks for $BOARD" >> $controlfile
|
|
|
|
|
|
|
|
# set up post install script
|
|
|
|
echo "#!/bin/bash" > $destination/DEBIAN/postinst
|
|
|
|
chmod 755 $destination/DEBIAN/postinst
|
|
|
|
|
|
|
|
# scripts for autoresize at first boot
|
|
|
|
mkdir -p $destination/etc/init.d
|
|
|
|
mkdir -p $destination/etc/default
|
|
|
|
|
|
|
|
install -m 755 $SRC/lib/scripts/resize2fs $destination/etc/init.d
|
|
|
|
install -m 755 $SRC/lib/scripts/firstrun $destination/etc/init.d
|
|
|
|
|
2016-01-20 09:19:03 +01:00
|
|
|
# install hardware info script
|
2015-12-02 20:33:32 +01:00
|
|
|
install -m 755 $SRC/lib/scripts/armhwinfo $destination/etc/init.d
|
|
|
|
echo "set -e" >> $destination/DEBIAN/postinst
|
|
|
|
echo "update-rc.d armhwinfo defaults >/dev/null 2>&1" >> $destination/DEBIAN/postinst
|
|
|
|
echo "update-rc.d -f motd remove >/dev/null 2>&1" >> $destination/DEBIAN/postinst
|
|
|
|
echo "[[ -f /root/.nand1-allwinner.tgz ]] && rm /root/.nand1-allwinner.tgz" >> $destination/DEBIAN/postinst
|
|
|
|
echo "[[ -f /root/nand-sata-install ]] && rm /root/nand-sata-install" >> $destination/DEBIAN/postinst
|
2016-01-20 09:19:03 +01:00
|
|
|
echo "ln -sf /var/run/motd /etc/motd" >> $destination/DEBIAN/postinst
|
2016-01-21 23:09:53 +01:00
|
|
|
echo "[[ -f /etc/bash.bashrc.custom ]] && rm /etc/bash.bashrc.custom" >> $destination/DEBIAN/postinst
|
2015-12-02 20:33:32 +01:00
|
|
|
echo "exit 0" >> $destination/DEBIAN/postinst
|
|
|
|
|
|
|
|
# temper binary for USB temp meter
|
|
|
|
mkdir -p $destination/usr/local/bin
|
|
|
|
tar xfz $SRC/lib/bin/temper.tgz -C $destination/usr/local/bin
|
|
|
|
|
2016-03-01 22:27:09 +01:00
|
|
|
# add USB OTG port mode switcher
|
|
|
|
install -m 755 $SRC/lib/scripts/sunxi-musb $destination/usr/local/bin
|
2016-03-05 19:14:00 +01:00
|
|
|
|
|
|
|
# armbianmonitor (currently only to toggle boot verbosity and log upload)
|
|
|
|
install -m 755 $SRC/lib/scripts/armbianmonitor/armbianmonitor $destination/usr/local/bin
|
2016-03-01 22:27:09 +01:00
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
# replace hostapd from latest self compiled & patched
|
|
|
|
mkdir -p $destination/usr/sbin/
|
|
|
|
tar xfz $SRC/lib/bin/hostapd25-rt.tgz -C $destination/usr/sbin/
|
|
|
|
tar xfz $SRC/lib/bin/hostapd25.tgz -C $destination/usr/sbin/
|
|
|
|
|
|
|
|
# module evbug is loaded automagically at boot time but we don't want that
|
|
|
|
mkdir -p $destination/etc/modprobe.d/
|
|
|
|
echo "blacklist evbug" > $destination/etc/modprobe.d/ev-debug-blacklist.conf
|
|
|
|
|
|
|
|
# script to install to SATA
|
|
|
|
cp -R $SRC/lib/scripts/nand-sata-install/usr $destination/
|
|
|
|
chmod +x $destination/usr/lib/nand-sata-install/nand-sata-install.sh
|
|
|
|
ln -s ../lib/nand-sata-install/nand-sata-install.sh $destination/usr/sbin/nand-sata-install
|
2016-01-20 09:19:03 +01:00
|
|
|
|
|
|
|
# install custom motd with reboot and upgrade checking
|
|
|
|
mkdir -p $destination/root $destination/tmp $destination/etc/update-motd.d/ $destination/etc/profile.d
|
|
|
|
install -m 755 $SRC/lib/scripts/update-motd.d/* $destination/etc/update-motd.d/
|
2015-12-02 20:33:32 +01:00
|
|
|
install -m 755 $SRC/lib/scripts/check_first_login_reboot.sh $destination/etc/profile.d
|
2015-12-21 13:43:01 +01:00
|
|
|
install -m 755 $SRC/lib/scripts/check_first_login.sh $destination/etc/profile.d
|
2016-01-20 09:19:03 +01:00
|
|
|
cd $destination/
|
|
|
|
ln -s ../var/run/motd etc/motd
|
2015-12-02 20:33:32 +01:00
|
|
|
touch $destination/tmp/.reboot_required
|
|
|
|
|
|
|
|
if [[ $LINUXCONFIG == *sun* ]] ; then
|
|
|
|
|
|
|
|
if [ "$BRANCH" != "next" ]; then
|
|
|
|
# add soc temperature app
|
|
|
|
arm-linux-gnueabihf-gcc $SRC/lib/scripts/sunxi-temp/sunxi_tp_temp.c -o $destination/usr/local/bin/sunxi_tp_temp
|
|
|
|
fi
|
|
|
|
|
|
|
|
# lamobo R1 router switch config
|
|
|
|
tar xfz $SRC/lib/bin/swconfig.tgz -C $destination/usr/local/bin
|
|
|
|
|
|
|
|
# convert and add fex files
|
|
|
|
unset IFS
|
|
|
|
mkdir -p $destination/boot/bin
|
|
|
|
for i in $(ls -w1 $SRC/lib/config/*.fex | xargs -n1 basename); do
|
|
|
|
fex2bin $SRC/lib/config/${i%*.fex}.fex $destination/boot/bin/${i%*.fex}.bin;
|
|
|
|
done
|
2016-02-24 11:47:54 +01:00
|
|
|
# One H3 image for all Fast Ethernet equipped Orange Pi H3
|
|
|
|
cp -p "$destination/boot/bin/orangepi2.bin" "$destination/boot/bin/orangepih3.bin"
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
# bluetooth device enabler - for cubietruck
|
2016-02-28 19:40:01 +01:00
|
|
|
install -m 755 $SRC/lib/bin/brcm_bt_reset $destination/usr/local/bin
|
2015-12-02 20:33:32 +01:00
|
|
|
install -m 755 $SRC/lib/bin/brcm_patchram_plus $destination/usr/local/bin
|
|
|
|
install $SRC/lib/scripts/brcm40183 $destination/etc/default
|
|
|
|
install -m 755 $SRC/lib/scripts/brcm40183-patch $destination/etc/init.d
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2016-03-03 11:56:34 +01:00
|
|
|
# enable verbose kernel messages on first boot
|
2016-03-05 09:40:39 +01:00
|
|
|
mkdir -p $destination/boot
|
2016-03-03 11:56:34 +01:00
|
|
|
touch $destination/boot/.verbose
|
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
# add some summary to the image
|
|
|
|
fingerprint_image "$destination/etc/armbian.txt"
|
|
|
|
|
|
|
|
# create board DEB file
|
|
|
|
cd $DEST/debs/$RELEASE/
|
2016-03-14 21:54:03 +03:00
|
|
|
display_alert "Building deb package." "$CHOSEN_ROOTFS" "info"
|
|
|
|
dpkg -b ${CHOSEN_ROOTFS}_${REVISION}_armhf >/dev/null
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
# clean up
|
2016-03-14 21:54:03 +03:00
|
|
|
rm -rf ${CHOSEN_ROOTFS}_${REVISION}_armhf
|
2015-12-02 20:33:32 +01:00
|
|
|
rm -f ../.reboot_required
|
2016-01-21 12:56:00 +01:00
|
|
|
}
|