developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # There are 2 env-variables set for you, you can use it in your script. |
| 4 | # ${BUILD_DIR} , working dir of this script, eg: openwrt/lede/ |
| 5 | # ${INSTALL_DIR}, where to install your build result, including: image, build log. |
| 6 | # |
| 7 | |
| 8 | #Global variable |
| 9 | BUILD_TIME=`date +%Y%m%d%H%M%S` |
| 10 | build_flag=0 |
| 11 | |
| 12 | if [ -z ${BUILD_DIR} ]; then |
| 13 | LOCAL=1 |
| 14 | BUILD_DIR=`pwd` |
| 15 | fi |
| 16 | |
| 17 | MTK_FEED_DIR=${BUILD_DIR}/feeds/mtk_openwrt_feed |
developer | 7273f5f | 2022-12-12 17:18:16 +0800 | [diff] [blame] | 18 | MTK_MANIFEST_FEED=${BUILD_DIR}/../mtk-openwrt-feeds |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 19 | |
| 20 | if [ -z ${INSTALL_DIR} ]; then |
| 21 | INSTALL_DIR=autobuild_release |
| 22 | mkdir -p ${INSTALL_DIR} |
| 23 | if [ ! -d target/linux ]; then |
| 24 | echo "You should call this scripts from openwrt's root directory." |
| 25 | fi |
| 26 | fi |
| 27 | |
| 28 | OPENWRT_VER=`cat ${BUILD_DIR}/feeds.conf.default | grep "src-git packages" | awk -F ";openwrt" '{print $2}'` |
developer | 068e1a4 | 2022-08-29 17:24:20 +0800 | [diff] [blame] | 29 | if [ -z ${OPENWRT_VER} ]; then |
| 30 | OPENWRT_VER=`cat ${BUILD_DIR}/feeds.conf.default | grep "src-git-full packages" | awk -F ";openwrt" '{print $2}'` |
| 31 | fi |
| 32 | |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 33 | cp ${BUILD_DIR}/feeds.conf.default ${BUILD_DIR}/feeds.conf.default_ori |
| 34 | |
| 35 | clean() { |
| 36 | echo "clean start!" |
| 37 | echo "It will take some time ......" |
| 38 | make distclean |
| 39 | rm -rf ${INSTALL_DIR} |
| 40 | echo "clean done!" |
| 41 | } |
| 42 | |
| 43 | do_patch(){ |
| 44 | files=`find $1 -name "*.patch" | sort` |
| 45 | for file in $files |
| 46 | do |
| 47 | patch -f -p1 -i ${file} || exit 1 |
| 48 | done |
| 49 | } |
| 50 | |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 51 | change_config_before_defconfig() { |
| 52 | return 0 |
| 53 | } |
| 54 | |
| 55 | change_config_after_defconfig() { |
| 56 | return 0 |
| 57 | } |
| 58 | |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 59 | prepare() { |
| 60 | echo "Preparing...." |
| 61 | #FIXME : workaround HOST PC build issue |
| 62 | #cd package/mtk/applications/luci-app-mtk/;git checkout Makefile;cd - |
| 63 | #mv package/mtk package/mtk_soc/ ./ |
| 64 | #rm -rf tmp/ feeds/ target/ package/ scripts/ tools/ include/ toolchain/ rules.mk |
| 65 | #git checkout target/ package/ scripts/ tools/ include/ toolchain/ rules.mk |
| 66 | #mv ./mtk ./mtk_soc/ package/ |
| 67 | cp ${BUILD_DIR}/autobuild/feeds.conf.default${OPENWRT_VER} ${BUILD_DIR}/feeds.conf.default |
| 68 | |
| 69 | #update feed |
| 70 | ${BUILD_DIR}/scripts/feeds update -a |
| 71 | |
| 72 | #check if manifest mtk_feed exist,if yes,overwrite and update it in feeds/ |
| 73 | if [ -d ${MTK_MANIFEST_FEED} ]; then |
| 74 | rm -rf ${MTK_FEED_DIR} |
| 75 | ln -s ${MTK_MANIFEST_FEED} ${MTK_FEED_DIR} |
| 76 | ${BUILD_DIR}/scripts/feeds update -a |
| 77 | fi |
| 78 | |
| 79 | #do mtk_feed prepare_sdk.sh |
| 80 | cp ${MTK_FEED_DIR}/prepare_sdk.sh ${BUILD_DIR} |
| 81 | |
| 82 | #if $1 exist(mt76), keep origin openwrt patches and remove mtk local eth driver |
| 83 | if [ -z ${1} ]; then |
| 84 | ${BUILD_DIR}/prepare_sdk.sh ${MTK_FEED_DIR} || exit 1 |
| 85 | else |
| 86 | ${BUILD_DIR}/prepare_sdk.sh ${MTK_FEED_DIR} ${1} || exit 1 |
| 87 | rm -rf ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/ |
| 88 | fi |
| 89 | #install feed |
| 90 | ${BUILD_DIR}/scripts/feeds install -a |
| 91 | ${BUILD_DIR}/scripts/feeds install -a luci |
| 92 | |
| 93 | #do mtk_soc openwrt patch |
| 94 | do_patch ${BUILD_DIR}/autobuild/openwrt_patches${OPENWRT_VER}/mtk_soc || exit 1 |
| 95 | } |
| 96 | |
| 97 | add_proprietary_kernel_files() { |
| 98 | #cp mtk proprietary ko_module source to mtk target |
| 99 | #and also need to be done in release mtk target |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 100 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 101 | # mean it is old process for possible build issue and should delete it gradually in the furture. |
| 102 | if [ ! -d ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless/wifi_utility ]; then |
| 103 | mkdir -p ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless |
| 104 | cp -rf ${BUILD_DIR}/../ko_module/gateway/proprietary_driver/drivers/wifi_utility/ ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless |
| 105 | fi |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 106 | |
| 107 | cp -fpR ${BUILD_DIR}/autobuild/target/ ${BUILD_DIR} |
| 108 | } |
| 109 | |
| 110 | prepare_mtwifi() { |
| 111 | #remove officail OpenWRT wifi script |
| 112 | #wifi-profile pkg will install wifi_jedi instead |
| 113 | rm -rf ${BUILD_DIR}/package/base-files/files/sbin/wifi |
| 114 | |
| 115 | add_proprietary_kernel_files |
| 116 | |
| 117 | #do mtk_wifi openwrt patch |
| 118 | do_patch ${BUILD_DIR}/autobuild/openwrt_patches${OPENWRT_VER}/mtk_wifi || exit 1 |
| 119 | } |
| 120 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 121 | prepare_flowoffload() { |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 122 | #cp bridger and related utilities from master |
| 123 | cp -fpR ${BUILD_DIR}/./../mac80211_package/include/bpf.mk ${BUILD_DIR}/include |
| 124 | |
| 125 | cp -fpR ${BUILD_DIR}/./../mac80211_package/include/kernel-5.15 ${BUILD_DIR}/include |
| 126 | |
| 127 | cp -fpR ${BUILD_DIR}/./../mac80211_package/target/llvm-bpf ${BUILD_DIR}/target |
| 128 | |
| 129 | cp -fpR ${BUILD_DIR}/./../mac80211_package/tools/llvm-bpf ${BUILD_DIR}/tools |
| 130 | |
| 131 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/kernel/bpf-headers ${BUILD_DIR}/package/kernel |
| 132 | |
| 133 | rm -rf ${BUILD_DIR}/package/network/utils/bpftools |
| 134 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/network/utils/bpftools ${BUILD_DIR}/package/network/utils |
| 135 | |
| 136 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/network/services/bridger ${BUILD_DIR}/package/network/services |
| 137 | |
| 138 | patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0010-add-llvm_bpf-toolchain.patch |
| 139 | |
developer | 3fb2e8c | 2022-07-08 11:35:22 +0800 | [diff] [blame] | 140 | patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0004-2102-netfilter-remove-nf_flow_table_hw.patch |
| 141 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 142 | #rm patches for flowblock |
| 143 | rm -rf ./target/linux/generic/pending-5.4/64*.patch |
| 144 | rm -rf ./target/linux/generic/hack-5.4/647-netfilter-flow-acct.patch |
| 145 | rm -rf ./target/linux/generic/hack-5.4/650-netfilter-add-xt_OFFLOAD-target.patch |
| 146 | rm -rf ./target/linux/mediatek/patches-5.4/1002-mtkhnat-add-support-for-virtual-interface-acceleration.patch |
| 147 | |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 148 | #hack mt7988 config5.4 |
| 149 | echo "CONFIG_BRIDGE_NETFILTER=y" >> ./target/linux/mediatek/mt7988/config-5.4 |
| 150 | echo "CONFIG_NETFILTER_FAMILY_BRIDGE=y" >> ./target/linux/mediatek/mt7988/config-5.4 |
| 151 | echo "CONFIG_SKB_EXTENSIONS=y" >> ./target/linux/mediatek/mt7988/config-5.4 |
| 152 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 153 | #hack mt7986 config5.4 |
| 154 | echo "CONFIG_BRIDGE_NETFILTER=y" >> ./target/linux/mediatek/mt7986/config-5.4 |
| 155 | echo "CONFIG_NETFILTER_FAMILY_BRIDGE=y" >> ./target/linux/mediatek/mt7986/config-5.4 |
| 156 | echo "CONFIG_SKB_EXTENSIONS=y" >> ./target/linux/mediatek/mt7986/config-5.4 |
| 157 | |
| 158 | #hack mt7622 config5.4 |
| 159 | echo "CONFIG_BRIDGE_NETFILTER=y" >> ./target/linux/mediatek/mt7622/config-5.4 |
| 160 | echo "CONFIG_NETFILTER_FAMILY_BRIDGE=y" >> ./target/linux/mediatek/mt7622/config-5.4 |
| 161 | echo "CONFIG_SKB_EXTENSIONS=y" >> ./target/linux/mediatek/mt7622/config-5.4 |
| 162 | } |
| 163 | |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 164 | prepare_mac80211() { |
developer | 7b9aeab | 2022-06-13 11:31:33 +0800 | [diff] [blame] | 165 | rm -rf ${BUILD_DIR}/package/network/services/hostapd |
| 166 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/network/services/hostapd ${BUILD_DIR}/package/network/services |
| 167 | |
| 168 | rm -rf ${BUILD_DIR}/package/libs/libnl-tiny |
| 169 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/libs/libnl-tiny ${BUILD_DIR}/package/libs |
| 170 | |
| 171 | rm -rf ${BUILD_DIR}/package/network/utils/iw |
developer | bd32d6d | 2022-06-14 13:19:41 +0800 | [diff] [blame] | 172 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/network/utils/iw ${BUILD_DIR}/package/network/utils |
developer | 7b9aeab | 2022-06-13 11:31:33 +0800 | [diff] [blame] | 173 | |
| 174 | rm -rf ${BUILD_DIR}/package/network/utils/iwinfo |
| 175 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/network/utils/iwinfo ${BUILD_DIR}/package/network/utils |
| 176 | |
| 177 | rm -rf ${BUILD_DIR}/package/kernel/mac80211 |
developer | 7273f5f | 2022-12-12 17:18:16 +0800 | [diff] [blame] | 178 | if [ $1 = "1" ]; then |
| 179 | echo "=========================MAC80211 v6.1===================" |
| 180 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/kernel/mac80211 ${BUILD_DIR}/package/kernel |
| 181 | rm -rf ${MTK_FEED_DIR}/autobuild_mac80211_release/package/kernel/mac80211 |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 182 | mv ${MTK_FEED_DIR}/autobuild_mac80211_release/package/kernel/mac80211_dev ${MTK_FEED_DIR}/autobuild_mac80211_release/package/kernel/mac80211 |
developer | 7273f5f | 2022-12-12 17:18:16 +0800 | [diff] [blame] | 183 | else |
| 184 | echo "=========================MAC80211 v5.15==================" |
| 185 | tar xvf ${MTK_FEED_DIR}/autobuild_mac80211_release/package/kernel/mac80211/mac80211_v5.15.81_077622a1.tar.gz -C ${BUILD_DIR}/package/kernel/ |
developer | 77ffbda | 2022-12-16 04:36:08 +0800 | [diff] [blame] | 186 | rm -rf ${MTK_FEED_DIR}/autobuild_mac80211_release/package/kernel/mac80211/mac80211_v5.15.81_077622a1.tar.gz |
developer | 7273f5f | 2022-12-12 17:18:16 +0800 | [diff] [blame] | 187 | fi |
developer | 7b9aeab | 2022-06-13 11:31:33 +0800 | [diff] [blame] | 188 | |
| 189 | rm -rf ${BUILD_DIR}/package/firmware/wireless-regdb |
developer | bd32d6d | 2022-06-14 13:19:41 +0800 | [diff] [blame] | 190 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/firmware/wireless-regdb ${BUILD_DIR}/package/firmware |
developer | 7b9aeab | 2022-06-13 11:31:33 +0800 | [diff] [blame] | 191 | |
developer | a18966d | 2022-12-22 14:26:02 +0800 | [diff] [blame] | 192 | # do not directly remove mt76 folder, since the firmware folder will also be removed and enter an unsync state |
| 193 | rm -rf ${BUILD_DIR}/package/kernel/mt76/Makefile |
| 194 | rm -rf ${BUILD_DIR}/package/kernel/mt76/patches |
| 195 | rm -rf ${BUILD_DIR}/package/kernel/mt76/src |
| 196 | cp -fpR ${BUILD_DIR}/./../mac80211_package/package/kernel/mt76 ${BUILD_DIR}/package/kernel |
developer | f0de14b | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 197 | |
| 198 | #hack hostapd config |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 199 | echo "CONFIG_MBO=y" >> ./package/network/services/hostapd/files/hostapd-full.config |
| 200 | echo "CONFIG_WPS_UPNP=y" >> ./package/network/services/hostapd/files/hostapd-full.config |
| 201 | echo "CONFIG_DPP=y" >> ./package/network/services/hostapd/files/hostapd-full.config |
| 202 | echo "CONFIG_DPP2=y" >> ./package/network/services/hostapd/files/hostapd-full.config |
| 203 | echo "CONFIG_DPP3=y" >> ./package/network/services/hostapd/files/hostapd-full.config |
| 204 | echo "CONFIG_DPP=y" >> ./package/network/services/hostapd/files/wpa_supplicant-full.config |
| 205 | echo "CONFIG_DPP2=y" >> ./package/network/services/hostapd/files/wpa_supplicant-full.config |
| 206 | echo "CONFIG_DPP3=y" >> ./package/network/services/hostapd/files/wpa_supplicant-full.config |
| 207 | |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 208 | patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0001-master-mac80211-generate-hostapd-setting-from-ap-cap.patch |
| 209 | patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0002-master-hostapd-makefile-for-utils.patch |
| 210 | patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0003-master-mt76-makefile-for-new-chip.patch |
| 211 | cp -rfa ${MTK_FEED_DIR}/autobuild_mac80211_release/package/ ${BUILD_DIR} |
developer | 73b9312 | 2022-04-19 23:16:58 +0800 | [diff] [blame] | 212 | cp -rfa ${MTK_FEED_DIR}/autobuild_mac80211_release/target/ ${BUILD_DIR} |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 213 | } |
| 214 | |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 215 | copy_main_Config() { |
| 216 | echo cp -rfa autobuild/$1/.config ./.config |
| 217 | cp -rfa autobuild/$1/.config ./.config |
| 218 | } |
| 219 | |
| 220 | install_output_Image() { |
| 221 | mkdir -p ${INSTALL_DIR}/$1 |
| 222 | |
| 223 | files=`find bin/targets/$3/*${2}* -name "*.bin" -o -name "*.img"` |
| 224 | file_count=0 |
| 225 | |
| 226 | for file in $files |
| 227 | do |
| 228 | tmp=${file%.*} |
| 229 | cp -rf $file ${INSTALL_DIR}/$1/${tmp##*/}-${BUILD_TIME}.${file##*.} |
| 230 | ((file_count++)) |
| 231 | done |
| 232 | |
| 233 | if [ ${file_count} = 0 ]; then |
| 234 | if [ ${build_flag} -eq 0 ]; then |
| 235 | let build_flag+=1 |
| 236 | echo " Restart to debug-build with "make V=s -j1", starting......" |
| 237 | build $1 -j1 || [ "$LOCAL" != "1" ] |
| 238 | else |
| 239 | echo " **********Failed to build $1, bin missing.**********" |
| 240 | fi |
| 241 | else |
| 242 | echo "Install image OK!!!" |
| 243 | echo "Build $1 successfully!" |
| 244 | fi |
| 245 | } |
| 246 | |
| 247 | install_output_Config() { |
| 248 | echo cp -rfa autobuild/$1/.config ${INSTALL_DIR}/$1/openwrt.config |
| 249 | cp -rfa autobuild/$1/.config ${INSTALL_DIR}/$1/openwrt.config |
| 250 | [ -f tmp/kernel.config ] && cp tmp/kernel.config ${INSTALL_DIR}/$1/kernel.config |
| 251 | } |
| 252 | |
| 253 | install_output_KernelDebugFile() { |
| 254 | KernelDebugFile=bin/targets/$3/mt${2}*/kernel-debug.tar.bz2 |
| 255 | if [ -f ${KernelDebugFile} ]; then |
| 256 | echo cp -rfa ${KernelDebugFile} ${INSTALL_DIR}/$1/kernel-debug.tar.bz2 |
| 257 | cp -rfa ${KernelDebugFile} ${INSTALL_DIR}/$1/kernel-debug.tar.bz2 |
| 258 | fi |
| 259 | } |
| 260 | |
| 261 | install_output_RootfsDebugFile() { |
| 262 | STAGING_DIR_ROOT=$(make -f "autobuild/get_stagingdir_root.mk" get-staging-dir-root) |
| 263 | if [ -d ${STAGING_DIR_ROOT} ]; then |
| 264 | STAGING_DIR_ROOT_PREFIX=$(dirname ${STAGING_DIR_ROOT}) |
| 265 | STAGING_DIR_ROOT_NAME=$(basename ${STAGING_DIR_ROOT}) |
| 266 | echo "tar -jcf ${INSTALL_DIR}/$1/rootfs-debug.tar.bz2 -C \"$STAGING_DIR_ROOT_PREFIX\" \"$STAGING_DIR_ROOT_NAME\"" |
| 267 | tar -jcf ${INSTALL_DIR}/$1/rootfs-debug.tar.bz2 -C "$STAGING_DIR_ROOT_PREFIX" "$STAGING_DIR_ROOT_NAME" |
| 268 | fi |
| 269 | } |
| 270 | |
| 271 | install_output_feeds_buildinfo() { |
| 272 | feeds_buildinfo=$(find bin/targets/$3/*${2}*/ -name "feeds.buildinfo") |
| 273 | echo "feeds_buildinfo=$feeds_buildinfo" |
| 274 | if [ -f ${feeds_buildinfo} ]; then |
| 275 | cp -rf $feeds_buildinfo ${INSTALL_DIR}/$1/feeds.buildinfo |
| 276 | else |
| 277 | echo "feeds.buildinfo is not found!!!" |
| 278 | fi |
| 279 | } |
| 280 | |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 281 | install_output_at() { |
| 282 | tar -zcvf to at.tgz -C ${INSTALL_DIR}/$1 . |
| 283 | mv to_at.tgz ${INSTALL_DIR}/ |
| 284 | } |
| 285 | |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 286 | install_release() { |
| 287 | temp=${1#*mt} |
| 288 | chip_name=${temp:0:4} |
| 289 | temp1=`grep "CONFIG_TARGET_ramips=y" autobuild/$1/.config` |
| 290 | |
| 291 | if [ "${temp1}" == "CONFIG_TARGET_ramips=y" ]; then |
| 292 | arch_name="ramips" |
| 293 | else |
| 294 | arch_name="mediatek" |
| 295 | fi |
| 296 | |
| 297 | #install output image |
| 298 | install_output_Image $1 ${chip_name} ${arch_name} |
| 299 | |
| 300 | #install output config |
| 301 | install_output_Config $1 |
| 302 | |
| 303 | #install output Kernel-Debug-File |
| 304 | install_output_KernelDebugFile $1 ${chip_name} ${arch_name} |
| 305 | |
| 306 | #tar unstripped rootfs for debug symbols |
| 307 | install_output_RootfsDebugFile $1 |
| 308 | |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 309 | #install output feeds buildinfo |
| 310 | install_output_feeds_buildinfo $1 ${chip_name} ${arch_name} |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | prepare_final() { |
| 314 | #cp customized autobuild SDK patches |
| 315 | cp -fpR ${BUILD_DIR}/autobuild/$1/target/ ${BUILD_DIR} |
| 316 | cp -fpR ${BUILD_DIR}/autobuild/$1/package/ ${BUILD_DIR} |
developer | 7273f5f | 2022-12-12 17:18:16 +0800 | [diff] [blame] | 317 | cp -fpR ${BUILD_DIR}/autobuild/$1/tools/ ${BUILD_DIR} |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 318 | |
| 319 | |
| 320 | #cp special subtarget patches |
| 321 | case $1 in |
| 322 | mt7986*) |
| 323 | cp -rf ${BUILD_DIR}/autobuild/mt7986-AX6000/target/linux/mediatek/patches-5.4/*.* ${BUILD_DIR}/target/linux/mediatek/patches-5.4 |
| 324 | ;; |
| 325 | *) |
| 326 | ;; |
| 327 | esac |
| 328 | |
| 329 | #rm old legacy patch, ex old nfi nand driver |
| 330 | case $1 in |
| 331 | mt7986*|\ |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 332 | mt7981*|\ |
| 333 | mt7988*) |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 334 | rm -rf ${BUILD_DIR}/target/linux/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch |
| 335 | ;; |
| 336 | *) |
| 337 | ;; |
| 338 | esac |
| 339 | |
| 340 | cd ${BUILD_DIR} |
| 341 | [ -f autobuild/$1/.config ] || { |
| 342 | echo "unable to locate autobuild/$1/.config !" |
| 343 | return |
| 344 | } |
| 345 | |
| 346 | rm -rf ./tmp |
| 347 | #copy main test config(.config) |
| 348 | copy_main_Config $1 |
| 349 | |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 350 | change_config_before_defconfig |
| 351 | |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 352 | echo make defconfig |
| 353 | make defconfig |
developer | 699cda2 | 2022-12-17 15:21:57 +0800 | [diff] [blame] | 354 | |
| 355 | change_config_after_defconfig |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 356 | } |
| 357 | |
| 358 | build() { |
| 359 | echo "###############################################################################" |
| 360 | echo "# $1" |
| 361 | echo "###############################################################################" |
| 362 | echo "build $1" |
| 363 | |
| 364 | cd ${BUILD_DIR} |
| 365 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 366 | #make |
| 367 | |
| 368 | echo "make V=s -j $(($(nproc) + 1)) download world" |
| 369 | make V=s -j $(($(nproc) + 1)) download world || exit 1 |
| 370 | |
| 371 | #tar unstripped rootfs for debug symbols |
| 372 | install_release $1 |
| 373 | } |
| 374 | |
| 375 | build_log() { |
| 376 | echo "###############################################################################" |
| 377 | echo "# $1" |
| 378 | echo "###############################################################################" |
| 379 | echo "build $1" |
| 380 | |
| 381 | cd ${BUILD_DIR} |
| 382 | |
| 383 | #make |
| 384 | |
| 385 | echo "make V=s -j $(($(nproc) + 1)) download world" |
| 386 | make V=s -j $(($(nproc) + 1)) download world || make V=s -j1 || exit 1 |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 387 | |
| 388 | #tar unstripped rootfs for debug symbols |
| 389 | install_release $1 |
| 390 | } |