Skip to content

Commit

Permalink
Merge pull request #1 from TurBoTse/main
Browse files Browse the repository at this point in the history
test
  • Loading branch information
minax007 authored Feb 20, 2022
2 parents fb34d08 + edd549d commit 27f8180
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ env:
CONFIG_FIRMWARE_INCLUDE_SMBD36
CONFIG_FIRMWARE_INCLUDE_3PROXY
CONFIG_FIRMWARE_INCLUDE_SMARTDNS
CONFIG_FIRMWARE_INCLUDE_WIREGUARD
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -155,6 +156,7 @@ jobs:
sh dl_toolchain.sh
- name: Modify configs
run: |
if [ -d meIsreallyba/modify ]; then cp -rf meIsreallyba/modify/* $build_dir/trunk/; fi
cd $build_dir/trunk/configs/templates
for m in $targets; do if [ -f $m.config ]; then \
for n in $ENABLED_CFG; do sed -i "/${n}/c${n}=y" $m.config; done; \
Expand Down
200 changes: 200 additions & 0 deletions meIsreallyba/modify/build_firmware_modify
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
#!/bin/bash

if [ -z "$1" ] || [ "$EUID" != 0 ]; then
echo "Please run 'fakeroot $0 PRODUCT_NAME' to start build (see 'configs/templates/')"
echo "For Windows Subsystem for Linux(WSL), use 'fakeroot-tcp' instead of 'fakeroot', or run with sudo"
exit 1
fi

if [ ! -f configs/templates/$1.config ] ; then
echo "configs/templates/$1.config not found!"
exit 1
fi

cp -f configs/templates/$1.config .config

ROOTDIR=`pwd`
export ROOTDIR=$ROOTDIR

kernel_id="4.4.x"
kernel_cf=""
kernel_tf=""
busybox_id="1.24.x"
busybox_cf="$ROOTDIR/configs/boards/busybox.config"
busybox_tf="$ROOTDIR/user/busybox/busybox-${busybox_id}/.config"
board_h=""
board_mk=""
paragon_hfsplus=0

func_enable_kernel_param()
{
if [ -n "`grep \^\"\# $1 is not set\" $kernel_tf`" ] ; then
sed -i "s/\# $1 is not set/$1=y/" $kernel_tf
fi
}

func_disable_kernel_param()
{
if [ -n "`grep \^$1=y $kernel_tf`" ] ; then
sed -i "s/$1=y/\# $1 is not set/" $kernel_tf
elif [ -n "`grep \^$1=m $kernel_tf`" ] ; then
sed -i "s/$1=m/\# $1 is not set/" $kernel_tf
fi
}

func_enable_busybox_param()
{
if [ -n "`grep \^\"\# $1 is not set\" $busybox_tf`" ] ; then
sed -i "s/\# $1 is not set/$1=y/" $busybox_tf
fi
}

func_disable_busybox_param()
{
if [ -n "`grep \^$1=y $busybox_tf`" ] ; then
sed -i "s/$1=y/\# $1 is not set/" $busybox_tf
fi
}
. $ROOTDIR/toolchain.inc
echo "CONFIG_TOOLCHAIN_DIR=${CONFIG_TOOLCHAIN_DIR}" >> .config

# load project root config
. $ROOTDIR/.config

if [ ! -f "$ROOTDIR/vendors/Ralink/config.arch" ] ; then
echo "Project product dir not found! Terminate."
exit 1
fi

if [ ! -d "$ROOTDIR/$CONFIG_LINUXDIR" ] ; then
echo "Project Linux Kernel dir ($CONFIG_LINUXDIR) not found! Terminate."
exit 1
fi

board_h="$ROOTDIR/configs/boards/$CONFIG_FIRMWARE_PRODUCT_ID/board.h"
board_mk="$ROOTDIR/configs/boards/$CONFIG_FIRMWARE_PRODUCT_ID/board.mk"
kernel_cd="$ROOTDIR/configs/boards/$CONFIG_FIRMWARE_PRODUCT_ID"
kernel_tf="$ROOTDIR/$CONFIG_LINUXDIR/.config"

if [ "$CONFIG_FIRMWARE_TYPE_ROOTFS_IN_RAM" = "y" ] ; then
kernel_cf="${kernel_cd}/kernel-${kernel_id}.ram.config"
elif [ -n "$CONFIG_FIRMWARE_KERNEL_CONFIG" ]; then
kernel_cf="${kernel_cd}/$CONFIG_FIRMWARE_KERNEL_CONFIG"
else
kernel_cf="${kernel_cd}/kernel-${kernel_id}.config"
fi

if [ ! -f "$kernel_cf" ] ; then
echo "Target kernel config ($kernel_cf) not found! Terminate."
exit 1
fi

if [ ! -f "$busybox_cf" ] ; then
echo "Target BusyBox config ($busybox_cf) not found! Terminate."
exit 1
fi

if [ ! -f "$board_h" ] ; then
echo "Target board header ($board_h) not found! Terminate."
exit 1
fi

if [ ! -f "$board_mk" ] ; then
echo "Target board descriptor ($board_mk) not found! Terminate."
exit 1
fi

rm -rf $ROOTDIR/romfs
rm -rf $ROOTDIR/images
mkdir -p $ROOTDIR/romfs
mkdir -p $ROOTDIR/images

# load source kernel config
. "$kernel_cf"

echo --------------------------COPY-CONFIG-----------------------------
######################### FOR-ALL-DEVICES #############################
ln -sf vendors/Ralink/config.arch config.arch
cp -fL "$kernel_cf" "$kernel_tf"
cp -fL "$busybox_cf" "$busybox_tf"
cp -fL "$board_mk" "$ROOTDIR/user/shared/board.mk"
cp -fL "$board_h" "$ROOTDIR/user/shared/include/ralink_board.h"
############################# SMP #####################################
if [ -n "$CONFIG_SMP" ] ; then
func_enable_busybox_param "CONFIG_FEATURE_TOP_SMP_CPU"
func_enable_busybox_param "CONFIG_FEATURE_TOP_SMP_PROCESS"
fi
############################# RTC #####################################
if [ -n "$CONFIG_RTC_CLASS" ] ; then
func_enable_busybox_param "CONFIG_HWCLOCK"
fi
# SFE
if [ "$CONFIG_FIRMWARE_INCLUDE_SFE" = "y" ] ; then
func_enable_kernel_param "CONFIG_SHORTCUT_FE"
fi
# wireguard
if [ "$CONFIG_FIRMWARE_INCLUDE_WIREGUARD" = "y" ]; then
func_enable_kernel_param "CONFIG_WIREGUARD"
else
func_disable_kernel_param "CONFIG_WIREGUARD"
fi
# SQM QOS
if [ "$CONFIG_FIRMWARE_INCLUDE_SQM" = "y" ]; then
func_enable_kernel_param "CONFIG_NF_CONNTRACK_EVENTS"
sed -i "/CONFIG_NF_CONNTRACK_EVENTS=y/a\CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y" $kernel_tf
func_enable_kernel_param "CONFIG_NF_CONNTRACK_TIMEOUT"
func_enable_kernel_param "CONFIG_NET_SCH_SFQ" "m"
sed -i "/CONFIG_NET_SCH_SFQ=m/a\CONFIG_NET_SCH_CAKE=m" $kernel_tf
func_enable_kernel_param "CONFIG_NET_SCH_CODEL" "m"
func_enable_kernel_param "CONFIG_NET_ACT_IPT" "m"
func_enable_kernel_param "CONFIG_IFB"
fi
#cpu超频
if [ "$CONFIG_FIRMWARE_INCLUDE_OC" = "y" ]; then
sed -i "/CONFIG_RALINK_MT7621=y/a\CONFIG_MT7621_OC=y" $kernel_tf
sed -i '/CONFIG_MT7621_OC=y/a\CONFIG_MT7621_CPU_FREQ="'$CONFIG_FIRMWARE_MT7621_OC'"' $kernel_tf
fi

############################# USB #####################################
if [ "$CONFIG_FIRMWARE_ENABLE_USB" != "y" ] || [ -z "$CONFIG_USB_SUPPORT" ] ; then
func_disable_busybox_param "CONFIG_FDISK"
func_disable_busybox_param "CONFIG_FEATURE_FDISK_WRITABLE"
func_disable_busybox_param "CONFIG_FEATURE_FDISK_ADVANCED"
func_disable_busybox_param "CONFIG_MICROCOM"
func_disable_busybox_param "CONFIG_EJECT"
func_disable_busybox_param "CONFIG_FEATURE_EJECT_SCSI"
func_disable_busybox_param "CONFIG_MKSWAP"
func_disable_busybox_param "CONFIG_SWAPONOFF"
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_FAT"
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_EXFAT"
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_NTFS"
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_HFS"
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_EXT"
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_XFS"
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_LINUXSWAP"
else
if [ "$CONFIG_FIRMWARE_ENABLE_UFSD" != "y" ] || [ $paragon_hfsplus -eq 0 ] ; then
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_HFS"
fi
############################ exFAT ####################################
if [ "$CONFIG_FIRMWARE_ENABLE_EXFAT" != "y" ] ; then
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_EXFAT"
fi
############################# XFS #####################################
if [ "$CONFIG_FIRMWARE_ENABLE_XFS" != "y" ] ; then
func_disable_busybox_param "CONFIG_FEATURE_VOLUMEID_XFS"
fi
############################# SWAP ####################################
if [ "$CONFIG_FIRMWARE_ENABLE_SWAP" != "y" ] ; then
func_disable_busybox_param "CONFIG_MKSWAP"
func_disable_busybox_param "CONFIG_SWAPONOFF"
fi
fi
############################# XFRM ####################################
#if [ "$CONFIG_FIRMWARE_INCLUDE_SSWAN" = "y" ] ; then
# CONFIG_FIRMWARE_INCLUDE_XFRM=y
#fi
echo --------------------------MAKE-DEP--------------------------------
make dep
echo --------------------------MAKE-ALL--------------------------------
make

0 comments on commit 27f8180

Please sign in to comment.