blob: 208f570ad209cc3341c53d65ce8d4c52aeba7608 [file] [log] [blame]
developerfd40db22021-04-29 10:08:25 +08001#!/bin/bash
2
3MTK_FEEDS_DIR=${1}
4
developer21871ba2021-11-05 17:00:05 +08005if [ -f feeds.conf.default_ori ]; then
developer06755a82024-01-09 10:58:20 +08006 OPENWRT_VER=`cat ./feeds.conf.default_ori | grep "src-git packages" | awk -F ";openwrt-" '{print $2}'`
developer068e1a42022-08-29 17:24:20 +08007
8 if [ -z ${OPENWRT_VER} ]; then
developer06755a82024-01-09 10:58:20 +08009 OPENWRT_VER=`cat ./feeds.conf.default_ori | grep "src-git-full packages" | awk -F ";openwrt-" '{print $2}'`
developer068e1a42022-08-29 17:24:20 +080010 fi
developer21871ba2021-11-05 17:00:05 +080011else
developer06755a82024-01-09 10:58:20 +080012 OPENWRT_VER=`cat ./feeds.conf.default | grep "src-git packages" | awk -F ";openwrt-" '{print $2}'`
developer068e1a42022-08-29 17:24:20 +080013
14 if [ -z ${OPENWRT_VER} ]; then
developer06755a82024-01-09 10:58:20 +080015 OPENWRT_VER=`cat ./feeds.conf.default | grep "src-git-full packages" | awk -F ";openwrt-" '{print $2}'`
developer068e1a42022-08-29 17:24:20 +080016 fi
developer21871ba2021-11-05 17:00:05 +080017fi
developerfd40db22021-04-29 10:08:25 +080018
19if [ -z ${1} ]; then
20 MTK_FEEDS_DIR=feeds/mtk_openwrt_feed
21fi
22
23remove_patches(){
24 echo "remove conflict patches"
developer06755a82024-01-09 10:58:20 +080025 for aa in `cat ${MTK_FEEDS_DIR}/${OPENWRT_VER}/remove_list-mtwifi.txt`
developerfd40db22021-04-29 10:08:25 +080026 do
27 echo "rm $aa"
28 rm -rf ./$aa
29 done
30}
31
developer06755a82024-01-09 10:58:20 +080032# $1: Directory containing patches
33apply_patches() {
34 local patches=`find ${1} -name "*.patch" | sort`
35
36 for file in $patches; do
37 echo -e "\nApplying ${file}"
developerfd40db22021-04-29 10:08:25 +080038 patch -f -p1 -i ${file} || exit 1
39 done
40}
41
developer06755a82024-01-09 10:58:20 +080042sdk_patch(){
43 apply_patches "${MTK_FEEDS_DIR}/${OPENWRT_VER}/patches-base"
44 apply_patches "${MTK_FEEDS_DIR}/${OPENWRT_VER}/patches-feeds"
45}
46
developerfd40db22021-04-29 10:08:25 +080047sdk_patch
48#cp mtk target to OpenWRT
developer06755a82024-01-09 10:58:20 +080049cp -fpR ${MTK_FEEDS_DIR}/${OPENWRT_VER}/files/* ./
developer6f1fc752022-02-10 17:24:44 +080050cp -fpR ${MTK_FEEDS_DIR}/tools ./
developer06755a82024-01-09 10:58:20 +080051
developerfd40db22021-04-29 10:08:25 +080052#remove patch if choose to not "keep" patch
53if [ -z ${2} ]; then
54 remove_patches
55fi
56