From 24b3e3819f21fdf424ffce3bbd911dafd2f773a3 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Mon, 5 Jun 2017 18:47:13 +0300 Subject: [PATCH] Refactor asound.state to use a variable for the file name --- build-all.sh | 2 +- config/sources/sun50iw1.conf | 12 +++++++----- config/sources/sun50iw2.conf | 8 ++------ config/sources/sun7i.conf | 6 ++---- config/sources/sun8i-r40.conf | 31 +------------------------------ config/sources/sun8i.conf | 10 ++++------ distributions.sh | 4 ++++ 7 files changed, 21 insertions(+), 52 deletions(-) diff --git a/build-all.sh b/build-all.sh index 975c1120a..dc85796d4 100644 --- a/build-all.sh +++ b/build-all.sh @@ -199,7 +199,7 @@ for line in "${buildlist[@]}"; do CPUMIN CPUMAX UBOOT_VER KERNEL_VER GOVERNOR BOOTSIZE BOOTFS_TYPE UBOOT_TOOLCHAIN KERNEL_TOOLCHAIN PACKAGE_LIST_EXCLUDE KERNEL_IMAGE_TYPE \ write_uboot_platform family_tweaks setup_write_uboot_platform BOOTSCRIPT UBOOT_TARGET_MAP LOCALVERSION UBOOT_COMPILER KERNEL_COMPILER \ MODULES MODULES_NEXT MODULES_DEV INITRD_ARCH HAS_UUID_SUPPORT BOOTENV_FILE BOOTDELAY MODULES_BLACKLIST MODULES_BLACKLIST_NEXT \ - MODULES_BLACKLIST_DEV MOUNT SDCARD BOOTPATCHDIR KERNELPATCHDIR buildtext RELEASE IMAGE_TYPE OVERLAY_PREFIX + MODULES_BLACKLIST_DEV MOUNT SDCARD BOOTPATCHDIR KERNELPATCHDIR buildtext RELEASE IMAGE_TYPE OVERLAY_PREFIX ASOUND_STATE read BOARD BRANCH RELEASE BUILD_DESKTOP <<< $line n=$[$n+1] diff --git a/config/sources/sun50iw1.conf b/config/sources/sun50iw1.conf index 361bf38f5..e87b59cb8 100644 --- a/config/sources/sun50iw1.conf +++ b/config/sources/sun50iw1.conf @@ -26,6 +26,12 @@ case $BRANCH in GOVERNOR=interactive INITRD_ARCH=arm + + if [[ $BOARD == pinebook-a64 ]]; then + ASOUND_STATE='asound.state.pinebooka64-default' + else + ASOUND_STATE='asound.state.pine64-default' + fi ;; dev) @@ -61,13 +67,9 @@ family_tweaks() for batlogo in low_pwr.bmp bempty.bmp battery_charge.bmp ; do cp "$SRC/lib/bin/icons/pinebook-a64_$batlogo" "$CACHEDIR/$SDCARD/boot/bat/$batlogo" done - # Audio / boot logo - mkdir -p $CACHEDIR/$SDCARD/var/lib/alsa/ + # boot logo if [[ $BOARD == pinebook-a64 ]]; then - cp $SRC/lib/config/asound.state.pinebooka64-default $CACHEDIR/$SDCARD/var/lib/alsa/asound.state cp "$SRC/lib/bin/icons/pinebook-a64_bootlogo.bmp" "$CACHEDIR/$SDCARD/bootlogo.bmp" - else - cp $SRC/lib/config/asound.state.pine64-default $CACHEDIR/$SDCARD/var/lib/alsa/asound.state fi fi if [[ $BRANCH == dev && $BOARD == pine64so ]]; then diff --git a/config/sources/sun50iw2.conf b/config/sources/sun50iw2.conf index 6528396f1..a11bc7c97 100644 --- a/config/sources/sun50iw2.conf +++ b/config/sources/sun50iw2.conf @@ -9,13 +9,9 @@ BOOTENV_FILE='sun50iw2-next.txt' [[ -z $CPUMAX ]] && CPUMAX=1010000 GOVERNOR=ondemand +ASOUND_STATE='asound.state.sun50iw2-dev' + write_uboot_platform() { dd if=$1/u-boot-sunxi-with-spl.bin of=$2 bs=1k seek=8 conv=fsync > /dev/null 2>&1 } - -family_tweaks() -{ - mkdir -p $CACHEDIR/$SDCARD/var/lib/alsa/ - cp $SRC/lib/config/asound.state.sun50iw2-dev $CACHEDIR/$SDCARD/var/lib/alsa/asound.state -} diff --git a/config/sources/sun7i.conf b/config/sources/sun7i.conf index 3da388463..b71545727 100644 --- a/config/sources/sun7i.conf +++ b/config/sources/sun7i.conf @@ -14,6 +14,8 @@ case $BRANCH in next) CPUMAX=960000 + + ASOUND_STATE='asound.state.sunxi-next' ;; dev) @@ -39,8 +41,4 @@ family_tweaks() sed -e 's/DEVICE=""/DEVICE="\/dev\/input\/event1"/g' -i $CACHEDIR/$SDCARD/etc/lirc/hardware.conf sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="devinput"/g' -i $CACHEDIR/$SDCARD/etc/lirc/hardware.conf cp $SRC/lib/config/lirc.conf.cubietruck $CACHEDIR/$SDCARD/etc/lirc/lircd.conf - if [[ $BRANCH == next ]]; then - mkdir -p $CACHEDIR/$SDCARD/var/lib/alsa/ - cp $SRC/lib/config/asound.state.sunxi-next $CACHEDIR/$SDCARD/var/lib/alsa/asound.state - fi } diff --git a/config/sources/sun8i-r40.conf b/config/sources/sun8i-r40.conf index cb39f7ed0..82a24ae57 100644 --- a/config/sources/sun8i-r40.conf +++ b/config/sources/sun8i-r40.conf @@ -1,7 +1,7 @@ source "${BASH_SOURCE%/*}/sunxi_common.inc" -[[ -z $OVERLAY_PREFIX ]] && OVERLAY_PREFIX='sun8i-h3' +[[ -z $OVERLAY_PREFIX ]] && OVERLAY_PREFIX='sun8i-r40' case $BRANCH in dev) @@ -18,32 +18,3 @@ esac [[ -z $CPUMIN ]] && CPUMIN=480000 [[ -z $CPUMAX ]] && CPUMAX=1010000 - -family_tweaks() -{ - # this is for legacy kernel only - sed -e 's/DEVICE=""/DEVICE="\/dev\/lirc0"/g' -i $CACHEDIR/$SDCARD/etc/lirc/hardware.conf - sed -e 's/MODULES=""/MODULES="sunxi_cir"/g' -i $CACHEDIR/$SDCARD/etc/lirc/hardware.conf - sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="default"/g' -i $CACHEDIR/$SDCARD/etc/lirc/hardware.conf - cp $SRC/lib/config/lirc.conf.cubietruck $CACHEDIR/$SDCARD/etc/lirc/lircd.conf - mkdir -p $CACHEDIR/$SDCARD/var/lib/alsa/ - if [[ $BRANCH == default ]]; then - cp $SRC/lib/config/asound.state.sun8i-default $CACHEDIR/$SDCARD/var/lib/alsa/asound.state - else - cp $SRC/lib/config/asound.state.sun8i-dev $CACHEDIR/$SDCARD/var/lib/alsa/asound.state - fi - # enable serial gadget on OTG port since the board doesn't have Ethernet - case ${BOARD} in - orangepilite|nanopiair|orangepizero*) - mkdir -p $CACHEDIR/$SDCARD/etc/systemd/system/serial-getty@ttyGS0.service.d - if [[ $BRANCH == default ]]; then - cat <<-EOF > $CACHEDIR/$SDCARD/etc/systemd/system/serial-getty@ttyGS0.service.d/10-switch-role.conf - [Service] - ExecStartPre=-/bin/sh -c "echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role" - EOF - fi - chroot $CACHEDIR/$SDCARD /bin/bash -c "systemctl --no-reload enable serial-getty@ttyGS0.service > /dev/null" - echo "ttyGS0" >> $CACHEDIR/$SDCARD/etc/securetty - ;; - esac -} diff --git a/config/sources/sun8i.conf b/config/sources/sun8i.conf index c9de2e2c2..332f24d05 100644 --- a/config/sources/sun8i.conf +++ b/config/sources/sun8i.conf @@ -10,6 +10,8 @@ case $BRANCH in KERNELSOURCE='https://github.com/igorpecovnik/linux' KERNELBRANCH='branch:sun8i' KERNELDIR='linux-sun8i' + + ASOUND_STATE='asound.state.sun8i-default' ;; dev) @@ -18,6 +20,8 @@ case $BRANCH in KERNELDIR='linux-sun8i-mainline' GOVERNOR=ondemand + + ASOUND_STATE='asound.state.sun8i-dev' ;; esac @@ -31,12 +35,6 @@ family_tweaks() sed -e 's/MODULES=""/MODULES="sunxi_cir"/g' -i $CACHEDIR/$SDCARD/etc/lirc/hardware.conf sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="default"/g' -i $CACHEDIR/$SDCARD/etc/lirc/hardware.conf cp $SRC/lib/config/lirc.conf.cubietruck $CACHEDIR/$SDCARD/etc/lirc/lircd.conf - mkdir -p $CACHEDIR/$SDCARD/var/lib/alsa/ - if [[ $BRANCH == default ]]; then - cp $SRC/lib/config/asound.state.sun8i-default $CACHEDIR/$SDCARD/var/lib/alsa/asound.state - else - cp $SRC/lib/config/asound.state.sun8i-dev $CACHEDIR/$SDCARD/var/lib/alsa/asound.state - fi # enable serial gadget on OTG port since the board doesn't have Ethernet case ${BOARD} in orangepilite|nanopiair|orangepizero*) diff --git a/distributions.sh b/distributions.sh index 790ab5188..ab2db110a 100644 --- a/distributions.sh +++ b/distributions.sh @@ -176,6 +176,10 @@ install_common() # to prevent creating swap file on NFS (needs specific kernel options) # and f2fs/btrfs (not recommended or needs specific kernel options) [[ $ROOTFS_TYPE != ext4 ]] && touch $CACHEDIR/$SDCARD/var/swap + + # install initial asound.state if defined + mkdir -p $CACHEDIR/$SDCARD/var/lib/alsa/ + [[ -n $ASOUND_STATE ]] && cp $SRC/lib/config/$ASOUND_STATE $CACHEDIR/$SDCARD/var/lib/alsa/asound.state } install_distribution_specific()