Small fixes and improvements

This commit is contained in:
zador-blood-stained 2016-08-20 22:53:50 +03:00
parent f0293d77bf
commit 2baeffed12
7 changed files with 33 additions and 50 deletions

View File

@ -112,15 +112,17 @@ compile_uboot()
compile_sunxi_tools()
{
#---------------------------------------------------------------------------------------------------------------------------------
# https://github.com/linux-sunxi/sunxi-tools Tools to help hacking Allwinner devices
#---------------------------------------------------------------------------------------------------------------------------------
display_alert "Compiling sunxi tools" "@host & target" "info"
cd $SOURCES/$MISC1_DIR
make -s clean >/dev/null
make -s tools >/dev/null
mkdir -p /usr/local/bin/
make install-tools >/dev/null 2>&1
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools.git" "sunxi-tools" "branch:master"
# Compile and install only if git commit hash changed
cd $SOURCES/sunxi-tools
if [[ ! -f .commit_id || $(git rev-parse @ 2>/dev/null) != $(<.commit_id) ]]; then
display_alert "Compiling" "sunxi-tools" "info"
make -s clean >/dev/null
make -s tools >/dev/null
mkdir -p /usr/local/bin/
make install-tools >/dev/null 2>&1
git rev-parse @ 2>/dev/null > .commit_id
fi
}
compile_kernel()

View File

@ -1,5 +0,0 @@
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty --noclear 115200 ttyS0

View File

@ -19,8 +19,6 @@ SDSIZE="4000" # SD image size in MB
TZDATA=`cat /etc/timezone` # Timezone for target is taken from host or defined here.
USEALLCORES="yes" # Use all CPU cores for compiling
EXIT_PATCHING_ERROR="" # exit patching if failed
MISC1="https://github.com/linux-sunxi/sunxi-tools.git" # Allwinner fex compiler / decompiler
MISC1_DIR="sunxi-tools" # local directory
MISC5="https://github.com/hglm/a10disp/" # Display changer for Allwinner
MISC5_DIR="sunxi-display-changer" # local directory
HOST="$BOARD" # set hostname to the board

View File

@ -40,6 +40,7 @@ install_common()
chroot $CACHEDIR/sdcard /bin/bash -c "chage -d 0 root"
# tmpfs configuration
# Takes effect only in Wheezy and Trusty
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
@ -63,7 +64,6 @@ install_common()
# initial date for fake-hwclock
date -u '+%Y-%m-%d %H:%M:%S' > $CACHEDIR/sdcard/etc/fake-hwclock.data
# set hostname
echo $HOST > $CACHEDIR/sdcard/etc/hostname
# this is needed for ubuntu
@ -71,12 +71,14 @@ install_common()
echo "nameserver 8.8.8.8" >> $CACHEDIR/sdcard/etc/resolv.conf
# set hostname in hosts file
echo "127.0.0.1 localhost $HOST" > $CACHEDIR/sdcard/etc/hosts
echo "::1 localhost $HOST ip6-localhost ip6-loopback" >> $CACHEDIR/sdcard/etc/hosts
echo "fe00::0 ip6-localnet" >> $CACHEDIR/sdcard/etc/hosts
echo "ff00::0 ip6-mcastprefix" >> $CACHEDIR/sdcard/etc/hosts
echo "ff02::1 ip6-allnodes" >> $CACHEDIR/sdcard/etc/hosts
echo "ff02::2 ip6-allrouters" >> $CACHEDIR/sdcard/etc/hosts
cat <<-EOF > $CACHEDIR/sdcard/etc/hosts
127.0.0.1 localhost $HOST
::1 localhost $HOST ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
EOF
# extract kernel version
VER=$(dpkg --info $DEST/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb | grep Descr | awk '{print $(NF)}')
@ -127,6 +129,9 @@ install_common()
# remove .old on new image
rm -rf $CACHEDIR/sdcard/boot/dtb.old
# enable verbose kernel messages on first boot
touch $CACHEDIR/sdcard/boot/.verbose
}
install_distribution_specific()
@ -135,7 +140,7 @@ install_distribution_specific()
case $RELEASE in
wheezy) # Debian Wheezy
wheezy)
# add serial console
echo T0:2345:respawn:/sbin/getty -L $SERIALCON 115200 vt100 >> $CACHEDIR/sdcard/etc/inittab
@ -157,7 +162,6 @@ install_distribution_specific()
sed -e 's/umountnfs $time/umountnfs $time ramlog/g' -i $CACHEDIR/sdcard/etc/init.d/rsyslog
;;
# Debian Jessie
jessie)
# enable root login for latest ssh on jessie
sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $CACHEDIR/sdcard/etc/ssh/sshd_config
@ -185,11 +189,15 @@ install_distribution_specific()
cp $SRC/lib/config/71-axp-power-button.rules $CACHEDIR/sdcard/etc/udev/rules.d/
;;
# Ubuntu Trusty
trusty)
# add serial console
cp $SRC/lib/config/ttyS0.conf $CACHEDIR/sdcard/etc/init/$SERIALCON.conf
sed -e "s/ttyS0/$SERIALCON/g" -i $CACHEDIR/sdcard/etc/init/$SERIALCON.conf
cat <<-EOF > $CACHEDIR/sdcard/etc/init/$SERIALCON.conf
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty --noclear 115200 $SERIALCON
EOF
# don't clear screen tty1
sed -e s,"exec /sbin/getty","exec /sbin/getty --noclear",g -i $CACHEDIR/sdcard/etc/init/tty1.conf

View File

@ -183,7 +183,6 @@ BOOTSOURCEDIR=$BOOTDIR/${BOOTBRANCH##*:}
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
LINUXSOURCEDIR=$KERNELDIR/${KERNELBRANCH##*:}
if [[ -n $MISC1 ]]; then fetch_from_github "$MISC1" "$MISC1_DIR"; fi
if [[ -n $MISC5 ]]; then fetch_from_github "$MISC5" "$MISC5_DIR"; fi
if [[ -n $MISC6 ]]; then fetch_from_github "$MISC6" "$MISC6_DIR"; fi

View File

@ -44,7 +44,7 @@ create_board_package()
# set up pre install script
cat <<-EOF > $destination/DEBIAN/preinst
#!/bin/sh
[ "$1" = "upgrade" ] && touch /var/run/.reboot_required
[ "\$1" = "upgrade" ] && touch /var/run/.reboot_required
[ -d "/boot/bin" ] && mv /boot/bin /boot/bin.old
if [ -L "/etc/network/interfaces" ]; then
cp /etc/network/interfaces /etc/network/interfaces.tmp
@ -75,7 +75,7 @@ create_board_package()
chmod 755 $destination/DEBIAN/postinst
# won't recreate files if they were removed by user
# everything in /etc is a conffile by default
# TODO: Add proper handling for updated conffiles
cat <<-EOF > $destination/DEBIAN/conffiles
/boot/.verbose
EOF
@ -220,10 +220,6 @@ create_board_package()
fi
# enable verbose kernel messages on first boot
mkdir -p $destination/boot
touch $destination/boot/.verbose
# add some summary to the image
fingerprint_image "$destination/etc/armbian.txt"

View File

@ -94,16 +94,6 @@ collect_information() {
esac
} # collect_information
display_alert() {
if [ "${DISTRIBUTION}" == "wheezy" ]; then
echo -e "[\e[0;32m ok \x1B[0m] ${1}" > /dev/tty1
elif [ "${DISTRIBUTION}" == "jessie" ]; then
echo -e "[\e[0;32m OK \x1B[0m] ${1}" > /dev/tty1
else
echo -e " * ${1}" > /dev/tty1
fi
}
adjust_sunxi_settings() {
# set some mac address for wifi
[[ "$(lsmod | grep 8189fs)" != "" ]] && \
@ -228,7 +218,6 @@ do_expand_rootfs() {
FREESIZE=$(df -hm / | awk '/\// {print $(NF-2)}')
if [[ "$DISTRIBUTION" == "wheezy" || "$s" != "0" || "$FREESIZE" -lt "152" ]]; then
touch /var/run/reboot
display_alert "Automatic reboot is needed. Please wait"
update-rc.d resize2fs defaults >/dev/null 2>&1
echo -e "\n### [firstrun] Automated reboot needed to let /etc/init.d/resize2fs do the job" >>${Log}
fi
@ -246,13 +235,9 @@ main() {
collect_information
if [[ "$rootfstype" == "ext4" && ! -f "/root/.no_rootfs_resize" ]]; then
display_alert "Resizing root filesystem."
do_expand_rootfs
fi
display_alert "Starting 128Mb emergency swap area creation."
display_alert "Starting SSH keys recreation."
touch /tmp/firstrun_running
/tmp/create_swap.sh &