From 0ef3dc5a262fbba2d55dcbbdb671169addbbf8e5 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 6 Mar 2021 16:26:45 +0100 Subject: [PATCH] Added kernel version check and fixed config checking --- build.sh | 55 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/build.sh b/build.sh index cd014728..ea8cc1ab 100755 --- a/build.sh +++ b/build.sh @@ -220,31 +220,40 @@ if [ "$OMR_TARGET" = "bpi-r1" -a "$OMR_OPENWRT" = "master" ]; then fi if [ "$OMR_TARGET" = "bpi-r1" ]; then - # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch - echo -n "Removing unwanted patches from kernel 5.4..." - rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-5.4/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 - echo "done" + # Check kernel version + if [ "$OMR_KERNEL" != "5.4" ]; then + echo "Sorry, but for now kernel 5.4 is the only supported one." + exit 1 + fi + + if [ "$OMR_KERNEL" = "5.4" ]; then + # Remove the 310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th patch + echo -n "Removing unwanted patches from kernel $OMR_KERNEL..." + rm -f "$OMR_TARGET/source/target/linux/sunxi/patches-$OMR_KERNEL/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch" >/dev/null 2>&1 + echo "done" + fi if [ "$OMR_FORCE_DSA" = "1" ]; then # Remove support for swconfig echo -n "Removing swconfig support from openwrt config..." - for i in DEFAULT_swconfig PACKAGE_swconfig PACKAGE_kmod-swconfig PACKAGE_kmod-st10xp; do + for i in DEFAULT_swconfig PACKAGE_swconfig PACKAGE_kmod-swconfig; do sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/.config" done echo "done" - echo -n "Removing B53 swconfig support from kernel 5.4..." + echo -n "Removing B53 swconfig support from kernel $OMR_KERNEL..." for i in SWCONFIG_B53 SWCONFIG_B53_PHY_DRIVER SWCONFIG_LEDS LED_TRIGGER_PHY SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" # Add support for distributed switch architecture - echo -n "Adding B53 DSA support to kernel 5.4..." + echo -n "Adding B53 DSA support to kernel $OMR_KERNEL..." for i in B53 B53_MDIO_DRIVER BRIDGE_VLAN_FILTERING MDIO_BUS_MUX_MULTIPLEXER NET_DSA NET_DSA_TAG_8021Q NET_DSA_TAG_BRCM NET_DSA_TAG_BRCM_PREPEND; do - cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_${i}=y" || \ - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ - echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + + [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" @@ -259,10 +268,10 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then echo "done" # Remove swconfig parts - echo -n "Removing unneeded B53 swconfig parts from kernel 5.4..." + echo -n "Removing unneeded B53 swconfig parts from kernel $OMR_KERNEL..." for i in SWCONFIG_B53_PHY_FIXUP SWCONFIG_B53_SPI_DRIVER SWCONFIG_B53_MMAP_DRIVER SWCONFIG_B53_SRAB_DRIVER; do - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-5.4" - sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" + sed -i "s/CONFIG_${i}/# CONFIG_${i} is not set/" "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done" @@ -271,18 +280,20 @@ if [ "$OMR_TARGET" = "bpi-r1" ]; then fi # Add led support - echo -n "Adding LED TRIGGER support to kernel 5.4..." + echo -n "Adding LED TRIGGER support to kernel $OMR_KERNEL..." if [ "$OMR_FORCE_DSA" != "1" ]; then for i in SWCONFIG_LEDS LED_TRIGGER_PHY; do - cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_${i}=y" || \ - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_${i}=y" || \ - echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_${i}=y"` + + [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done fi for i in TIMER ONESHOT DISK MTD HEARTBEAT BACKLIGHT CPU ACTIVITY GPIO DEFAULT_ON TRANSIENT CAMERA PANIC NETDEV PATTERN AUDIO; do - cat "$OMR_TARGET/source/target/linux/sunxi/config-5.4" | grep "CONFIG_LEDS_TRIGGER_${i}=y" || \ - cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" | grep "CONFIG_LEDS_TRIGGER_${i}=y" || \ - echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-5.4" + check_sunxi_config=`cat "$OMR_TARGET/source/target/linux/sunxi/config-$OMR_KERNEL" | grep "CONFIG_LEDS_TRIGGER_${i}=y"` + check_cortexa7_config=`cat "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" | grep "CONFIG_LEDS_TRIGGER_${i}=y"` + + [ "$check_sunxi_config" = "" -a "$check_cortexa7_config" = "" ] && echo "CONFIG_LEDS_TRIGGER_${i}=y" >> "$OMR_TARGET/source/target/linux/sunxi/cortexa7/config-$OMR_KERNEL" done echo "done"