From 63d2b90cdc8e9962c0b6b88c6c23c78764db9dc9 Mon Sep 17 00:00:00 2001 From: lin <lin@kickpi.com> Date: Fri, 01 Aug 2025 03:33:27 +0000 Subject: [PATCH] feat(sleep): default deep sleep on --- build.sh | 69 +++++++++++++++++++++++++++++++++- 1 files changed, 66 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 8a2e427..0a4017f 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,16 @@ BOARD_CONFIG_DIR=longan/device/config/chips/ BOARD_CONFIG_FILE=longan/device/.BoardConfig.mk +DTS_DIR=$BOARD_CONFIG_DIR/a133/configs/c3 + +LCD_DTS=( + "lcd-lvds-7-1024-600.dtsi" + "lcd-lvds-21-1920-1080.dtsi" + "lcd-mipi-10-800-1280-v1.dtsi" + "lcd-mipi-10-800-1280-v2.dtsi" + "lcd-mipi-8-800-1280.dtsi" + "lcd-mipi-5-720-1280.dtsi" +) function build_lunch() { TARGET_BOARD_PATH_ARRAY=($(find $BOARD_CONFIG_DIR -name "BoardConfig-a133*.mk" | sort)) @@ -28,16 +38,42 @@ source $BOARD_CONFIG_FILE echo "you board is ${DTS_NAME}" + ln -rsf "${DTS_DIR}/${DTS_NAME}.fex" "${DTS_DIR}/sys_config.fex" echo "Start clean kerenl" + cd longan/kernel/linux-4.9 && make clean -j32 && cd - source $BOARD_CONFIG_FILE longan/build/mkcommon.sh autoconfig -i a133 -o android -b c3 } -if [ "x$1" == "xlunch" ]; then - build_lunch && exit 0 -else +function build() { + DTS_FILE=${DTS_DIR}/${DTS_NAME}.dts + for config in "${LCD_DTS[@]}"; do + # 检查未被注释的配置行(支持行首空格) + if grep -q -E "^[[:space:]]*#include \"${config}\"" "$DTS_FILE"; then + # 提取 lcd- 之后 .dtsi 之前的内容(去除头尾字符) + LCD_NAME=$(echo "$config" | sed 's/^lcd-\(.*\)\.dtsi$/\1/') + break + fi + done + + +sed -i -E " +/^[[:space:]]*export LCD_NAME=/ { + s|^(export LCD_NAME=).*$|\1${LCD_NAME}| + h + \$!{x;b};x + b done +} + +1 i export LCD_NAME=${LCD_NAME} + +:done +" "${BOARD_CONFIG_FILE}" + + source $BOARD_CONFIG_FILE + if [ x"$1" == "xuboot" ] || [ x"$1" == "xu" ] || [ x"$1" == "x" ]; then echo "Start build uboot" cd longan/brandy/brandy-2.0 @@ -95,4 +131,31 @@ pack cd - + +} + +if [ "x$1" == "xlunch" ]; then + build_lunch && exit 0 +else + source $BOARD_CONFIG_FILE + if [ "x$1" == "xall" ]; then + for config in "${LCD_DTS[@]}"; do + echo "正在切换设备树: $config" + # Step 1: 注释所有 LCD 相关行(无论原始是否已注释) + sed -i -E '/#include "lcd-/s|^([[:space:]]*)(//)?|\1//|' "$DTS_DIR/$DTS_NAME.dts" + + # Step 2: 解除目标配置的注释 + sed -i -E "s|^([[:space:]]*)//#include \"$config\"|\1#include \"$config\"|" "$DTS_DIR/$DTS_NAME.dts" + + # # 提取 lcd- 之后 .dtsi 之前的内容(去除头尾字符) + # LCD_DTS_FILE=$(echo "$config" | sed 's/^lcd-\(.*\)\.dtsi$/\1/') + + # 执行编译 + echo "开始编译..." + build + done + else + build $@ && exit 0 + fi + fi -- Gitblit v1.6.2