This commit is contained in:
Igor Pecovnik 2016-06-17 14:39:32 +02:00
commit 3b1bcc7c09
9 changed files with 124 additions and 127 deletions

View File

@ -73,10 +73,6 @@ install_board_specific (){
else
tr ' ' '\n' <<< "$MODULES" >> $CACHEDIR/sdcard/etc/modules
fi
# copy and create symlink to default interfaces configuration
cp $SRC/lib/config/network/interfaces.* $CACHEDIR/sdcard/etc/network/
ln -sf interfaces.default $CACHEDIR/sdcard/etc/network/interfaces
}

View File

@ -1,22 +1,22 @@
# Wired adapter #1
allow-hotplug eth0
iface eth0 inet dhcp
iface eth0 inet dhcp
# hwaddress ether # if you want to set MAC manually
# pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838
#
# Wired adapter #2
#auto eth1
# iface eth1 inet dhcp
#allow-hotplug eth1
#iface eth1 inet dhcp
# hwaddress ether # if you want to set MAC manually
# pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838
#
# Wireless adapter #1
#auto wlan0
# iface wlan0 inet dhcp
# wpa-ssid SSID
#allow-hotplug wlan0
#iface wlan0 inet dhcp
# wpa-ssid SSID
# wpa-psk xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# to generate proper encrypted key: wpa_passphrase yourSSID yourpassword
#
# Local loopback
auto lo
iface lo inet loopback
iface lo inet loopback

View File

@ -73,12 +73,12 @@ debootstrap_ng()
install_kernel
install_board_specific
# install desktop files
[[ $BUILD_DESKTOP == yes ]] && install_desktop
# install additional applications
[[ $EXTERNAL == yes ]] && install_external_applications
# install desktop files
[[ $BUILD_DESKTOP == yes ]] && install_desktop
# cleanup for install_kernel and install_board_specific
umount $CACHEDIR/sdcard/tmp

View File

@ -19,11 +19,8 @@ display_alert "Applying distribution specific tweaks for" "$RELEASE" "info"
# Common
# set up apt
cat <<END > $CACHEDIR/sdcard/etc/apt/apt.conf.d/71-no-recommends
APT::Install-Recommends "0";
APT::Install-Suggests "0";
END
# remove default interfaces file if present
rm $CACHEDIR/sdcard/etc/network/interfaces
# configure the system for unattended upgrades
cp $SRC/lib/scripts/50unattended-upgrades $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades
@ -182,16 +179,12 @@ xenial)
esac
# copy hostapd configurations
install -m 755 $SRC/lib/config/hostapd/hostapd.conf $CACHEDIR/sdcard/etc/hostapd.conf
install -m 755 $SRC/lib/config/hostapd/hostapd.realtek.conf $CACHEDIR/sdcard/etc/hostapd.conf-rt
install $SRC/lib/config/hostapd/hostapd.conf $CACHEDIR/sdcard/etc/hostapd.conf
install $SRC/lib/config/hostapd/hostapd.realtek.conf $CACHEDIR/sdcard/etc/hostapd.conf-rt
# console fix due to Debian bug
sed -e 's/CHARMAP=".*"/CHARMAP="'$CONSOLE_CHAR'"/g' -i $CACHEDIR/sdcard/etc/default/console-setup
# root-fs modifications
rm -f $CACHEDIR/sdcard/etc/motd
touch $CACHEDIR/sdcard/etc/motd
# change time zone data
echo $TZDATA > $CACHEDIR/sdcard/etc/timezone
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg-reconfigure -f noninteractive tzdata >/dev/null 2>&1"
@ -207,7 +200,7 @@ else
fi
echo "$device 0 0" >> $CACHEDIR/sdcard/etc/fstab
# flash media tunning
# flash media tuning
if [[ -f $CACHEDIR/sdcard/etc/default/tmpfs ]]; then
sed -e 's/#RAMTMP=no/RAMTMP=yes/g' -i $CACHEDIR/sdcard/etc/default/tmpfs
sed -e 's/#RUN_SIZE=10%/RUN_SIZE=128M/g' -i $CACHEDIR/sdcard/etc/default/tmpfs
@ -228,8 +221,4 @@ touch $CACHEDIR/sdcard/root/.not_logged_in_yet
# force change root password at first login
chroot $CACHEDIR/sdcard /bin/bash -c "chage -d 0 root"
# remove hostapd because it's replaced with ours
chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq remove hostapd >/dev/null 2>&1"
}

View File

@ -44,6 +44,7 @@ compile_hostapd()
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Installed-Size: 1
Section: net
Depends: libc6, libnl-3-200, libnl-genl-3-200, libssl1.0.0
Provides: armbian-hostapd
Conflicts: armbian-hostapd, hostapd
Priority: optional
@ -127,4 +128,5 @@ compile_hostapd()
[[ ! -f $DEST/debs/armbian-hostapd-${RELEASE}_${REVISION}_${ARCH}.deb ]] && compile_hostapd
display_alert "Installing" "armbian-hostapd-${RELEASE}_${REVISION}_${ARCH}.deb" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/armbian-hostapd-${RELEASE}_${REVISION}_${ARCH}.deb" >> $DEST/debug/hostapd-build.log
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -r hostapd" >> $DEST/debug/output.log
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/armbian-hostapd-${RELEASE}_${REVISION}_${ARCH}.deb" >> $DEST/debug/output.log

View File

@ -9,109 +9,99 @@
# This file is a part of tool chain https://github.com/igorpecovnik/lib
#
compile_tools ()
compile_tools()
{
sync
echo "Building sunxi-tools" > $DEST/debug/sunxi-tools-build.log 2>&1
local tmpdir=$CACHEDIR/sdcard/root/tools
display_alert "Building deb" "sunxi-tools" "info"
local tmpdir1="sdcard/tmp/sunxi-tools"
display_alert "... downloading sources" "sunxi-tools" "info"
git clone https://github.com/linux-sunxi/sunxi-tools $CACHEDIR/$tmpdir1 >> $DEST/debug/sunxi-tools-build.log 2>&1
local tmpdir2="sdcard/tmp/temper"
display_alert "... downloading sources" "temper" "info"
git clone -q https://github.com/padelt/pcsensor-temper $CACHEDIR/$tmpdir2 >> $DEST/debug/temper-build.log 2>&1
local tmpdir3="sdcard/tmp/brcm"
display_alert "... downloading sources" "BT utils" "info"
git clone -q https://github.com/phelum/CT_Bluetooth $CACHEDIR/$tmpdir3 >> $DEST/debug/brcm-build.log 2>&1
rm -f $CACHEDIR/$tmpdir3/brcm_patchram_plus $CACHEDIR/$tmpdir3/brcm_bt_reset $CACHEDIR/$tmpdir3/*.o
pack_to_deb ()
display_alert "... downloading sources" "sunxi-tools" "info"
git clone -q https://github.com/linux-sunxi/sunxi-tools $tmpdir/sunxi-tools >> $DEST/debug/sunxi-tools-build.log 2>&1
display_alert "... downloading sources" "temper" "info"
git clone -q https://github.com/padelt/pcsensor-temper $tmpdir/temper >> $DEST/debug/temper-build.log 2>&1
display_alert "... downloading sources" "BT utils" "info"
git clone -q https://github.com/phelum/CT_Bluetooth $tmpdir/brcm >> $DEST/debug/brcm-build.log 2>&1
rm -f $tmpdir/brcm/{brcm_patchram_plus,brcm_bt_reset} $tmpdir/brcm/*.o
pack_to_deb()
{
cd $CACHEDIR/sdcard/tmp
mkdir -p armbian-tools${TARGET}"_"${REVISION}_${ARCH}/DEBIAN armbian-tools${TARGET}"_"${REVISION}_${ARCH}/usr/bin armbian-tools${TARGET}"_"${REVISION}_${ARCH}/lib/udev/rules.d
mkdir -p $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/{DEBIAN,usr/bin,lib/udev/rules.d}
# set up control file
cat <<END > armbian-tools${TARGET}_${REVISION}_${ARCH}/DEBIAN/control
Package: armbian-tools$TARGET
Version: $REVISION
Architecture: $ARCH
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Installed-Size: 1
Depends: libc6 (>= 2.10), libusb-1.0-0 (>= 2:1.0.8)
Section: utils
Priority: optional
Description: Armbian tools, sunxi, temper
END
#
echo 'SUBSYSTEMS=="usb", ATTR{idVendor}=="1f3a", ATTR{idProduct}=="efe8", GROUP="sunxi-fel"' > armbian-tools${TARGET}_${REVISION}_${ARCH}/lib/udev/rules.d/60-sunxi-tools.rules
cp "$CACHEDIR/$tmpdir1/sunxi-bootinfo" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin
cp "$CACHEDIR/$tmpdir1/sunxi-fel" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin
cp "$CACHEDIR/$tmpdir1/sunxi-fexc" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin
ln -s sunxi-fexc armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin/fex2bin
ln -s sunxi-fexc armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin/bin2fex
cp "$CACHEDIR/$tmpdir1/sunxi-nand-part" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin
cp "$CACHEDIR/$tmpdir1/sunxi-pio" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin
cat <<-END > $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/DEBIAN/control
Package: armbian-tools-$RELEASE
Version: $REVISION
Architecture: $ARCH
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Installed-Size: 1
Provides: armbian-tools
Conflicts: armbian-tools, sunxi-tools
Depends: libc6 (>= 2.10), libusb-1.0-0 (>= 2:1.0.8), libusb-0.1-4, libudev1
Section: utils
Priority: optional
Description: Armbian tools, sunxi, temper
END
echo 'SUBSYSTEMS=="usb", ATTR{idVendor}=="1f3a", ATTR{idProduct}=="efe8", GROUP="sunxi-fel"' > $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/lib/udev/rules.d/60-sunxi-tools.rules
cp $tmpdir/sunxi-tools/{sunxi-bootinfo,sunxi-fel,sunxi-fexc,sunxi-nand-part,sunxi-pio} $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/usr/bin
ln -s sunxi-fexc $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/usr/bin/fex2bin
ln -s sunxi-fexc $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/usr/bin/bin2fex
# temper
cp "$CACHEDIR/$tmpdir2/src/pcsensor" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin/temper
cp $tmpdir/temper/src/pcsensor $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/usr/bin/temper
# brcm
cp "$CACHEDIR/$tmpdir3/brcm_bt_reset" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin
cp "$CACHEDIR/$tmpdir3/brcm_patchram_plus" armbian-tools${TARGET}_${REVISION}_${ARCH}/usr/bin
cd armbian-tools${TARGET}_${REVISION}_${ARCH}
cp $tmpdir/brcm/{brcm_bt_reset,brcm_patchram_plus} $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}/usr/bin
cd $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}
find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '%P ' | xargs md5sum > DEBIAN/md5sums
cd ..
dpkg -b armbian-tools${TARGET}_${REVISION}_${ARCH} >/dev/null 2>&1
rm -rf armbian-tools${TARGET}_${REVISION}_${ARCH}
cd $tmpdir
dpkg -b armbian-tools-${RELEASE}_${REVISION}_${ARCH} >/dev/null
mv $tmpdir/armbian-tools-${RELEASE}_${REVISION}_${ARCH}.deb $DEST/debs
cd $CACHEDIR
rm -rf $tmpdir
}
compiling ()
{
display_alert "... compiling" "sunxitools" "info"
cd $CACHEDIR/$tmpdir1
compiling()
{
display_alert "... compiling" "sunxitools" "info"
cd $tmpdir/sunxi-tools
git checkout -f -q ce9cf33606492076b81e1157ba9fc54b56379335 >> $DEST/debug/tools-build.log 2>&1
chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/sunxi-tools; make clean" >> $DEST/debug/tools-build.log 2>&1
chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/sunxi-tools; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1
if [ $? -ne 0 ] || [ ! -f $CACHEDIR/$tmpdir1/sunxi-fexc ]; then
display_alert "Not built" "tools" "err"
exit 1
chroot $CACHEDIR/sdcard /bin/bash -c "cd /root/tools/sunxi-tools; make clean" >> $DEST/debug/tools-build.log 2>&1
chroot $CACHEDIR/sdcard /bin/bash -c "cd /root/tools/sunxi-tools; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1
if [[ $? -ne 0 || ! -f $tmpdir/sunxi-tools/sunxi-fexc ]]; then
cd $CACHEDIR
rm -rf $tmpdir
exit_with_error "Error building" "sunxi-tools"
fi
display_alert "... compiling" "temper" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/temper/src; make clean" >> $DEST/debug/tools-build.log 2>&1
chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/temper/src; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1
if [ $? -ne 0 ] || [ ! -f $CACHEDIR/$tmpdir2/src/pcsensor ]; then
display_alert "Not built" "tools" "err"
exit 1
display_alert "... compiling" "temper" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "cd /root/tools/temper/src; make clean" >> $DEST/debug/tools-build.log 2>&1
chroot $CACHEDIR/sdcard /bin/bash -c "cd /root/tools/temper/src; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1
if [[ $? -ne 0 || ! -f $tmpdir/temper/src/pcsensor ]]; then
cd $CACHEDIR
rm -rf $tmpdir
exit_with_error "Error building" "temper"
fi
display_alert "... compiling" "bluetooth utils" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/brcm; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1
if [ $? -ne 0 ] || [ ! -f $CACHEDIR/$tmpdir3/brcm_bt_reset ]; then
display_alert "Not built" "tools" "err"
exit 1
display_alert "... compiling" "bluetooth utils" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "cd /root/tools/brcm; make $CTHREADS" >> $DEST/debug/tools-build.log 2>&1
if [[ $? -ne 0 || ! -f $tmpdir/brcm/brcm_bt_reset ]]; then
cd $CACHEDIR
rm -rf $tmpdir
exit_with_error "Error building" "BT utils"
fi
}
compiling
pack_to_deb
display_alert "Installing" "armbian-tools${TARGET}_${REVISION}_${ARCH}.deb" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/armbian-tools${TARGET}_${REVISION}_${ARCH}.deb" >> $DEST/debug/tools-build.log 2>&1
mv $CACHEDIR/sdcard/tmp/armbian-tools${TARGET}_${REVISION}_${ARCH}.deb $DEST/debs
}
if [[ -f "$DEST/debs/armbian-tools${TARGET}_${REVISION}_${ARCH}.deb" ]]; then
# install
echo "Installing tools" > $DEST/debug/tools-build.log 2>&1
display_alert "Installing" "armbian-tools${TARGET}_${REVISION}_${ARCH}.deb" "info"
cp $DEST/debs/armbian-tools${TARGET}_${REVISION}_${ARCH}.deb $CACHEDIR/sdcard/tmp
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/armbian-tools${TARGET}_${REVISION}_${ARCH}.deb" >> $DEST/debug/tools-build.log 2>&1
else
# compile
if [[ ! -f $DEST/debs/armbian-tools-${RELEASE}_${REVISION}_${ARCH}.deb ]]; then
compile_tools
fi
fi
display_alert "Installing" "armbian-tools-${RELEASE}_${REVISION}_${ARCH}.deb" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/armbian-tools-${RELEASE}_${REVISION}_${ARCH}.deb" >> $DEST/debug/tools-build.log

View File

@ -39,6 +39,8 @@ source $SRC/lib/general.sh # General functions
mkdir -p $DEST/debug
(cd $DEST/debug && tar -czf logs-$(date +"%d_%m_%Y-%H_%M_%S").tgz *.log) > /dev/null 2>&1
rm -f $DEST/debug/*.log > /dev/null 2>&1
# delete compressed logs older than 7 days
(cd $DEST/debug && find . -name '*.tgz' -atime +7 -delete) > /dev/null
# compile.sh version checking
ver1=$(awk -F"=" '/^# VERSION/ {print $2}' <"$SRC/compile.sh")

View File

@ -52,6 +52,12 @@ create_board_package()
#!/bin/sh
update-rc.d armhwinfo defaults >/dev/null 2>&1
update-rc.d -f motd remove >/dev/null 2>&1
if [ -L "/etc/network/interfaces" ]; then
cp /etc/network/interfaces /etc/network/interfaces.tmp
rm /etc/network/interfaces
mv /etc/network/interfaces.tmp /etc/network/interfaces
fi
[ ! -f "/etc/network/interfaces" ] && cp /etc/network/interfaces.default /etc/network/interfaces
[ -f "/root/.nand1-allwinner.tgz" ] && rm /root/.nand1-allwinner.tgz
[ -f "/root/nand-sata-install" ] && rm /root/nand-sata-install
ln -sf /var/run/motd /etc/motd
@ -106,7 +112,7 @@ create_board_package()
mkdir -p $destination/usr/local/bin
# add USB OTG port mode switcher
install -m 755 $SRC/lib/scripts/sunxi-musb $destination/usr/local/bin
install -m 755 $SRC/lib/scripts/sunxi-musb $destination/usr/local/bin
# armbianmonitor (currently only to toggle boot verbosity and log upload)
install -m 755 $SRC/lib/scripts/armbianmonitor/armbianmonitor $destination/usr/local/bin
@ -120,6 +126,18 @@ create_board_package()
EOF
chmod +x $destination/etc/initramfs/post-update.d/99-uboot
# network interfaces configuration
mkdir -p $destination/etc/network/
cp $SRC/lib/config/network/interfaces.* $destination/etc/network/
[[ $RELEASE = wheezy ]] && sed -i 's/allow-hotplug/auto/g' $destination/etc/network/interfaces.default
# apt configuration
mkdir -p $destination/etc/apt/apt.conf.d/
cat <<-EOF > $destination/etc/apt/apt.conf.d/71-no-recommends
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF
# script to install to SATA
mkdir -p $destination/usr/sbin/
cp -R $SRC/lib/scripts/nand-sata-install/usr $destination/
@ -153,6 +171,7 @@ create_board_package()
fi
# lamobo R1 router switch config
# TODO: compile from sources in sunxi-tools
tar xfz $SRC/lib/bin/swconfig.tgz -C $destination/usr/local/bin
# convert and add fex files
@ -162,10 +181,9 @@ create_board_package()
done
# bluetooth device enabler - for cubietruck
install -m 755 $SRC/lib/bin/brcm_bt_reset $destination/usr/local/bin
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
# TODO: move to tools or sunxi-common.inc
install $SRC/lib/scripts/brcm40183 $destination/etc/default
install -m 755 $SRC/lib/scripts/brcm40183-patch $destination/etc/init.d
fi

View File

@ -268,7 +268,7 @@ main() {
fi
update-rc.d -f firstrun remove >/dev/null 2>&1
sed -i 's/allow-hotplug\ eth0/auto eth0/' /etc/network/interfaces.default
#sed -i 's/allow-hotplug\ eth0/auto eth0/' /etc/network/interfaces.default
rm /tmp/firstrun_running
} # main