From e54a30dc772f450eacaf8ea517f97abfb5621c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Sat, 26 Dec 2015 10:25:00 +0100 Subject: [PATCH] Serial console becomes a configuration parameter so we can cleanup some code. Some small bug fixes on the way --- boards.sh | 111 ++++++++++++++++------------------------------- configuration.sh | 6 +++ distributions.sh | 54 ++++++++++------------- 3 files changed, 66 insertions(+), 105 deletions(-) diff --git a/boards.sh b/boards.sh index 63cdd95ffe..a648103aeb 100644 --- a/boards.sh +++ b/boards.sh @@ -37,52 +37,31 @@ install_board_specific (){ # Lemaker Guitar if [[ $BOARD == "guitar" ]] ; then - if [ -f $DEST/cache/sdcard/etc/inittab ]; then sed -e "s/ttyS0/ttyS3/g" -i $DEST/cache/sdcard/etc/inittab; fi - if [ -f $DEST/cache/sdcard/etc/init/ttyS0.conf ]; then - mv $DEST/cache/sdcard/etc/init/ttyS0.conf $DEST/cache/sdcard/etc/init/ttyS3.conf; - sed -e "s/ttyS0/ttyS3/g" -i $DEST/cache/sdcard/etc/init/ttyS3.conf; - fi - if [ -f $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service ]; then - mv $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service \ - $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS3.service - fi - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq autoremove >/dev/null 2>&1" - echo "blacklist wlan_8723bs_vq0" > $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist ctp_gslX680" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist ctp_gsl3680" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist gsensor_mir3da" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist gsensor_stk8313" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist gsensor_bma222" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist lightsensor_ltr301" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist wlan_8723bs_vq0" > $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist ctp_gslX680" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist ctp_gsl3680" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist gsensor_mir3da" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist gsensor_stk8313" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist gsensor_bma222" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist lightsensor_ltr301" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf fi # Odroid if [[ $BOARD == "odroidxu" ]] ; then - if [ -f $DEST/cache/sdcard/etc/inittab ]; then sed -e "s/ttyS0/ttySAC2/g" -i $DEST/cache/sdcard/etc/inittab; fi - echo "blacklist ina231_sensor" > $DEST/cache/sdcard/etc/modprobe.d/blacklist-odroid.conf - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc && apt-get -y -qq autoremove" + + echo "blacklist ina231_sensor" > $DEST/cache/sdcard/etc/modprobe.d/blacklist-odroid.conf + chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc" + fi # Udoo if [[ $BOARD == "udoo" ]] ; then - if [ -f $DEST/cache/sdcard/etc/inittab ]; then sed -e "s/ttyS0/ttymxc1/g" -i $DEST/cache/sdcard/etc/inittab; fi - if [ -f $DEST/cache/sdcard/etc/init/ttyS0.conf ]; then - mv $DEST/cache/sdcard/etc/init/ttyS0.conf $DEST/cache/sdcard/etc/init/ttymxc1.conf; - sed -e "s/ttyS0/ttymxc1/g" -i $DEST/cache/sdcard/etc/init/ttymxc1.conf; - fi - if [ -f $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service ]; then - mv $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service \ - $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttymxc1.service - fi - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc >/dev/null 2>&1" - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq autoremove >/dev/null 2>&1" - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.default - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.bonding - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.hostapd - # Udoo doesn't have interactive - sed -e 's/interactive/ondemand/g' -i $DEST/cache/sdcard/etc/init.d/cpufrequtils + chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc >/dev/null 2>&1" + sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.default + sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.bonding + sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.hostapd fi @@ -90,57 +69,41 @@ install_board_specific (){ # Udoo neo if [[ $BOARD == "udoo-neo" ]] ; then - if [ -f $DEST/cache/sdcard/etc/inittab ]; then sed -e "s/ttyS0/ttymxc0/g" -i $DEST/cache/sdcard/etc/inittab; fi - if [ -f $DEST/cache/sdcard/etc/init/ttyS0.conf ]; then - mv $DEST/cache/sdcard/etc/init/ttyS0.conf $DEST/cache/sdcard/etc/init/ttymxc0.conf - sed -e "s/ttyS0/ttymxc0/g" -i $DEST/cache/sdcard/etc/init/ttymxc0.conf - fi - if [ -f $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service ]; then - mv $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service \ - $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttymxc0.service - fi - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc && apt-get -y -qq autoremove" - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.default - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.bonding - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.hostapd - # SD card is elsewhere - sed 's/mmcblk0p1/mmcblk1p1/' -i $DEST/cache/sdcard/etc/fstab - # firmware for M4 - mkdir -p $DEST/cache/sdcard/boot/bin/ - cp $SRC/lib/bin/m4startup.fw* $DEST/cache/sdcard/boot/bin/ + chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc" + sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.default + sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.bonding + sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.hostapd + # SD card is elsewhere + sed 's/mmcblk0p1/mmcblk1p1/' -i $DEST/cache/sdcard/etc/fstab + # firmware for M4 + mkdir -p $DEST/cache/sdcard/boot/bin/ + cp $SRC/lib/bin/m4startup.fw* $DEST/cache/sdcard/boot/bin/ fi # cubox / hummingboard if [[ $BOARD == cubox-i* ]] ; then - - if [ -f $DEST/cache/sdcard/etc/inittab ]; then sed -e "s/ttyS0/ttymxc0/g" -i $DEST/cache/sdcard/etc/inittab; fi - if [ -f $DEST/cache/sdcard/etc/init/ttyS0.conf ]; then - mv $DEST/cache/sdcard/etc/init/ttyS0.conf $DEST/cache/sdcard/etc/init/ttymxc0.conf - sed -e "s/ttyS0/ttymxc0/g" -i $DEST/cache/sdcard/etc/init/ttymxc0.conf - fi - if [ -f $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service ]; then - mv $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service \ - $DEST/cache/sdcard/etc/systemd/system/getty.target.wants/serial-getty@ttymxc0.service - fi - # default lirc configuration - sed -e 's/DEVICE=""/DEVICE="\/dev\/lirc0"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf - sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="default"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf - cp $SRC/lib/config/lirc.conf.cubox-i $DEST/cache/sdcard/etc/lirc/lircd.conf - cp $SRC/lib/bin/brcm_patchram_plus_cubox $DEST/cache/sdcard/usr/local/bin/brcm_patchram_plus - chroot $DEST/cache/sdcard /bin/bash -c "chmod +x /usr/local/bin/brcm_patchram_plus" - cp $SRC/lib/scripts/brcm4330 $DEST/cache/sdcard/etc/default - cp $SRC/lib/scripts/brcm4330-patch $DEST/cache/sdcard/etc/init.d - chroot $DEST/cache/sdcard /bin/bash -c "chmod +x /etc/init.d/brcm4330-patch" - chroot $DEST/cache/sdcard /bin/bash -c "update-rc.d brcm4330-patch defaults>> /dev/null" + # default lirc configuration + sed -e 's/DEVICE=""/DEVICE="\/dev\/lirc0"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf + sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="default"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf + cp $SRC/lib/config/lirc.conf.cubox-i $DEST/cache/sdcard/etc/lirc/lircd.conf + cp $SRC/lib/bin/brcm_patchram_plus_cubox $DEST/cache/sdcard/usr/local/bin/brcm_patchram_plus + chroot $DEST/cache/sdcard /bin/bash -c "chmod +x /usr/local/bin/brcm_patchram_plus" + cp $SRC/lib/scripts/brcm4330 $DEST/cache/sdcard/etc/default + cp $SRC/lib/scripts/brcm4330-patch $DEST/cache/sdcard/etc/init.d + chroot $DEST/cache/sdcard /bin/bash -c "chmod +x /etc/init.d/brcm4330-patch" + chroot $DEST/cache/sdcard /bin/bash -c "update-rc.d brcm4330-patch defaults>> /dev/null" fi # install custom root package chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/$RELEASE/$CHOOSEN_ROOTFS.deb >/dev/null 2>&1" + # remove not needed packages + chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq autoremove >/dev/null 2>&1" + # enable first run script chroot $DEST/cache/sdcard /bin/bash -c "update-rc.d firstrun defaults >/dev/null 2>&1" diff --git a/configuration.sh b/configuration.sh index 5b8b78d09d..04682e61f4 100644 --- a/configuration.sh +++ b/configuration.sh @@ -34,6 +34,7 @@ SYSTEMD="no" # Enable or disable systemd on Jessie in debootstrap process OFFSET="1" # Bootloader space in MB (1 x 2048 = default) BOOTSIZE="0" # Mb size of boot partition + SERIALCON="ttyS0" MISC1="https://github.com/linux-sunxi/sunxi-tools.git" # Allwinner fex compiler / decompiler MISC1_DIR="sunxi-tools" # local directory MISC2="" # Reserved @@ -216,6 +217,7 @@ BOOTCONFIG="mx6_cubox-i_config" MODULES="bonding" MODULES_NEXT="bonding" + SERIALCON="ttymxc0" ;; udoo)#enabled @@ -225,6 +227,7 @@ BOOTCONFIG="udoo_qdl_config" MODULES="bonding" MODULES_NEXT="" + SERIALCON="ttymxc1" ;; udoo-neo)#enabled @@ -235,6 +238,7 @@ BOOTCONFIG="udoo_neo_config" MODULES="bonding" MODULES_NEXT="" + SERIALCON="ttymxc0" ;; guitar)#enabled @@ -246,6 +250,7 @@ BOOTCONFIG="s500_defconfig" MODULES="ethernet wlan_8723bs bonding" MODULES_NEXT="" + SERIALCON="ttyS3" ;; odroidxu)#enabled @@ -256,6 +261,7 @@ BOOTCONFIG="odroid_config" MODULES="bonding" MODULES_NEXT="" + SERIALCON="ttySAC2" ;; *) echo "Board configuration not found" diff --git a/distributions.sh b/distributions.sh index 5cdf4d4449..455a297394 100644 --- a/distributions.sh +++ b/distributions.sh @@ -17,13 +17,25 @@ install_distribution_specific (){ #--------------------------------------------------------------------------------------------------------------------------------- display_alert "Fixing release custom applications." "$RELEASE" "info" +# Common + +# set up apt +cat < $DEST/cache/sdcard/etc/apt/apt.conf.d/71-no-recommends +APT::Install-Recommends "0"; +APT::Install-Suggests "0"; +END + +# configure the system for unattended upgrades +cp $SRC/lib/scripts/50unattended-upgrades $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades +cp $SRC/lib/scripts/02periodic $DEST/cache/sdcard/etc/apt/apt.conf.d/02periodic + case $RELEASE in # Debian Wheezy wheezy) # add serial console - echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> $DEST/cache/sdcard/etc/inittab + echo T0:2345:respawn:/sbin/getty -L $SERIALCON 115200 vt100 >> $DEST/cache/sdcard/etc/inittab # don't clear screen on boot console sed -e 's/getty 38400 tty1/getty --noclear 38400 tty1/g' -i $DEST/cache/sdcard/etc/inittab @@ -64,28 +76,19 @@ jessie) mkdir $DEST/cache/sdcard/selinux # add serial console - cp $SRC/lib/config/ttyS0.conf $DEST/cache/sdcard/etc/init/ttyS0.conf - chroot $DEST/cache/sdcard /bin/bash -c "systemctl --no-reload enable serial-getty@ttyS0.service" - mkdir -p "$DEST/cache/sdcard/etc/systemd/system/serial-getty@ttyS0.service.d" - echo "[Service]" > "$DEST/cache/sdcard/etc/systemd/system/serial-getty@ttyS0.service.d/10-rate.conf" - echo "ExecStart=" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@ttyS0.service.d/10-rate.conf" - echo "ExecStart=-/sbin/agetty -L 115200 %I $TERM" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@ttyS0.service.d/10-rate.conf" + cp $SRC/lib/config/ttyS0.conf $DEST/cache/sdcard/etc/init/$SERIALCON.conf + sed -e "s/ttyS0/$SERIALCON/g" -i $DEST/cache/sdcard/etc/init/$SERIALCON.conf + chroot $DEST/cache/sdcard /bin/bash -c "systemctl --no-reload enable serial-getty@$SERIALCON.service" + mkdir -p "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d" + echo "[Service]" > "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + echo "ExecStart=" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + echo "ExecStart=-/sbin/agetty -L 115200 %I $TERM" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" # don't clear screen tty1 mkdir -p "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/" echo "[Service]" > "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" echo "TTYVTDisallocate=no" >> "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" - - # add serial console - echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> $DEST/cache/sdcard/etc/inittab - - # don't clear screen on boot console - sed -e 's/getty 38400 tty1/getty --noclear 38400 tty1/g' -i $DEST/cache/sdcard/etc/inittab - - # disable some getties - sed -e 's/5:23:respawn/#5:23:respawn/g' -i $DEST/cache/sdcard/etc/inittab - sed -e 's/6:23:respawn/#6:23:respawn/g' -i $DEST/cache/sdcard/etc/inittab - + # seting timeout mkdir -p $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/ echo "[Service]" > $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf @@ -96,7 +99,8 @@ jessie) trusty) # add serial console - cp $SRC/lib/config/ttyS0.conf $DEST/cache/sdcard/etc/init/ttyS0.conf + cp $SRC/lib/config/ttyS0.conf $DEST/cache/sdcard/etc/init/$SERIALCON.conf + sed -e "s/ttyS0/$SERIALCON/g" -i $DEST/cache/sdcard/etc/init/$SERIALCON.conf # don't clear screen tty1 sed -e s,"exec /sbin/getty","exec /sbin/getty --noclear",g -i $DEST/cache/sdcard/etc/init/tty1.conf @@ -130,18 +134,6 @@ exit ;; esac -# Common - -# set up apt -cat < $DEST/cache/sdcard/etc/apt/apt.conf.d/71-no-recommends -APT::Install-Recommends "0"; -APT::Install-Suggests "0"; -END - -# configure the system for unattended upgrades -cp $SRC/lib/scripts/50unattended-upgrades $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades -cp $SRC/lib/scripts/02periodic $DEST/cache/sdcard/etc/apt/apt.conf.d/02periodic - # copy hostapd configurations install -m 755 $SRC/lib/config/hostapd.conf $DEST/cache/sdcard/etc/hostapd.conf install -m 755 $SRC/lib/config/hostapd.realtek.conf $DEST/cache/sdcard/etc/hostapd.conf-rt