1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Added kernel version check and fixed config checking

This commit is contained in:
Olli 2021-03-06 16:26:45 +01:00
parent 53afc52057
commit 0ef3dc5a26

View file

@ -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"