本系列调试说明记录了Linux在全志T113-S3/S4平台上的移植过程,说明过程中可能会技术瑕疵,希望大家提供宝贵意见。
本文移植的硬件平台来自于盈鹏飞嵌入式的SBC-T113S(处理器是T113-S3)主板。
SBC-T113S产品特性:
- 采用Allwinner公司Cortex-A7双核T113-S3/S4处理器,运行最高速度为2GHZ;
- 内置64-bit XuanTie C906 RISC-V协处理器(仅T113-S4支持);
- 支持JPEG/MJPEG视频编码,最大分辨率1080p@60fps;支持多格式1080P@60fps视频解码 (H.265,H.264, MPEG-1/2/4);
- 支持RGB666/LVDS/MIPI-DSI,分辨率最高1920x1080;
- 支持128-256M Bytes DDR3 SDRAM,其中T113-S3内置128MB;T113-S4内置256MB;
- 支持SPI NAND存储和启动(默认:256MB;最大1GB)或者EMMC启动(默认:4GB,最大32GB);
- 支持一路USB2.0 OTG(设计为TYPE-A接口);支持二路USB2.0 HOST;
- 支持七路RS232通信或者6路RS232和1路RS485(隔离);
- 支持一路CAN BUS通信(隔离);
- 支持一路10/100M以太网;
- 稳定的操作系统的支持,可预装LINUX 5.4或者OpenWRT;
- 经典尺寸主板,尺寸为120*100MM;
产品功能评估图:
产品尺寸:
以下为T113 Linux 系统-Linux QT 介绍:
一级目录
t113_linux$ tree -L 1.
├── brandy
├── build
├── buildroot
├── build.sh
├── device
├── Docs
├── evb1_auto -> device/config/chips/t113/configs/evb1_auto/
├── kernel
├── platform
├── README.md
├── test
└── tools
brandy
全志boot相关目录
brandy/brandy-2.0$ tree -L 1.
├── build.sh -> tools/build.sh
├── spl-pub
├── tools
└── u-boot-2018
build
t113_linux/build$ tree .
├── bin
│ ├── dtco
│ ├── genext2fs
│ ├── makedevs
│ ├── make_ext4fs
│ ├── mkdtimg
│ ├── mke2img
│ ├── mkfs.ubifs
│ └── mksquashfs
├── createkeys
├── envsetup.sh
├── Makefile
├── mkcmd.sh
├── mkcommon.sh
├── mkkernel.sh
├── mksetup.sh
├── pack
├── parser.sh
├── ramdisk
│ ├── ramdisk.img
│ ├── rootfs_32bit_3.10.cpio.gz
│ └── rootfs_32bit_4.9.cpio.gz
├── shflags
├── toolchain
│ ├── gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz
│ ├── gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi.tar.xz
│ ├── gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
│ ├── gcc-linaro-aarch64.tar.xz
│ ├── gcc-linaro-arm.tar.xz
│ └── gcc-linaro.tar.bz2
└── top_build.sh
buildroot
使用的版本是 buildroot-201902,主要功能如下:
- 管理包之间的依赖关系
- 生成 ARM 工具链
- 制作根文件系统,可以包含 strace,directfb,oprofile 等非常丰富的应用软件和测试软件
- 生成最终用于烧写的固件包
buildroot/buildroot-201902$ tree -L 1.
├── arch
├── board
├── boot
├── build.sh
├── CHANGES
├── Config.in
├── Config.in.legacy
├── configs
├── COPYING
├── DEVELOPERS
├── dl
├── docs
├── fs
├── linux
├── Makefile
├── Makefile.legacy
├── package
├── README
├── scripts
├── support
├── system
├── toolchain
└── utils
- configs 目录里存放预定义好的配置文件,比如我们的 sun8iw20p1_t113_defconfig
- dl 目录里存放已经下载好的软件包
- scripts 目录里存放 buildroot 的编译脚本,mkcmd.sh,mkcommon.sh,mkrule 和 mksetup.sh 等
- target 目录里存放用于生成根文件系统的一些规则文件,该目录对于代码和工具的集成非常重要
- 对于我们来说最为重要的是 package 目录,里面存放了将近 3000 个软件包的生成规则,我们可以在里面添加我们自己的软件包或者是中间件
device
芯片配置目录,包含多个板级配置,每个板级配置都有不同的 board.dts, sys_config.fex 等配
t113_linux/device$ tree -L 3.
└── config
├── chips
│ └── t113
├── common
│ ├── debug
│ ├── dtb
│ ├── hdcp
│ ├── imagecfg
│ ├── partition
│ ├── sign_config
│ ├── toc
│ ├── tools
│ └── version
└── rootfs_tar
├── _device_table.txt
├── mini_rootfs.tar.bz2
├── target-arm64-linaro-5.3.tar.bz2
├── target_arm64.tar.bz2
├── target-arm-linaro-5.3.tar.bz2
├── target_arm.tar.bz2
├── tinyandroid_arm64.tar.bz2
└── tinyandroid_arm.tar.bz2
device->t113
t113_linux/device/config/chips/t113$ tree.
├── bin // 打包时使用的启动文件
│ ├── dsp0.bin
│ └── optee_sun8iw20p1.bin
├── boot-resource
│ ├── boot-resource
│ │ ├── bat
│ │ │ ├── bat0.bmp
│ │ │ ├── bat10.bmp
│ │ │ ├── bat1.bmp
│ │ │ ├── bat2.bmp
│ │ │ ├── bat3.bmp
│ │ │ ├── bat4.bmp
│ │ │ ├── bat5.bmp
│ │ │ ├── bat6.bmp
│ │ │ ├── bat7.bmp
│ │ │ ├── bat8.bmp
│ │ │ ├── bat9.bmp
│ │ │ ├── battery.bmp
│ │ │ ├── battery_charge.bmp
│ │ │ ├── bempty.bmp
│ │ │ └── low_pwr.bmp
│ │ ├── bootlogo.bmp // 启动画面,优先级低于板级目录下logo图片
│ │ ├── fastbootlogo.bmp
│ │ ├── font24.sft
│ │ ├── font32.sft
│ │ └── wavefile
│ │ ├── default_5_8.awf
│ │ ├── default.awf
│ │ └── vcom.bin
│ └── boot-resource.ini
├── configs
│ ├── default // 正常情况下不生效
│ │ ├── BoardConfig.mk
│ │ ├── BoardConfig_nor.mk
│ │ ├── boot_package.cfg
│ │ ├── boot_package_nor.cfg
│ │ ├── default.awlic
│ │ ├── diskfs.fex
│ │ ├── dragon_toc.cfg
│ │ ├── env_burn.cfg
│ │ ├── env.cfg
│ │ ├── env_dragon.cfg
│ │ ├── fit-image.its
│ │ ├── image.cfg
│ │ ├── image_linux.cfg
│ │ ├── image_nor.cfg
│ │ ├── parameter.fex
│ │ ├── sys_partition.fex
│ │ ├── sys_partition_nor.fex
│ │ ├── sysrecovery.fex
│ │ └── version_base.mk
│ ├── evb1 // 不支持
│ ├── evb1_auto // 默认的EMMC板型
│ │ ├── BoardConfig_rp-t113-buildroot.mk
│ │ ├── board.dts -> linux-5.4/board.dts // 板级dts配置
│ │ ├── bsp
│ │ │ ├── BoardConfig.mk
│ │ │ ├── boardConfig_nor.mk
│ │ │ ├── bootlogo.bmp
│ │ │ ├── env.cfg
│ │ │ ├── env_nor.cfg
│ │ │ ├── sys_partition.fex
│ │ │ └── sys_partition_nor.fex
│ │ ├── linux-5.4
│ │ │ ├── board.dts // 板级dts配置
│ │ │ └── config-5.4
│ │ ├── longan
│ │ │ ├── BoardConfig.mk // 内核,buildroot,工具链等配置
│ │ │ ├── boardConfig_nor.mk
│ │ │ ├── bootlogo.bmp // EMMC板型bootlogo图片
│ │ │ ├── env_ab.cfg
│ │ │ ├── env.cfg // EMMC板型环境变量
│ │ │ ├── env_nor.cfg
│ │ │ ├── env-recovery.cfg
│ │ │ ├── postinstall_A.sh
│ │ │ ├── postinstall_B.sh
│ │ │ ├── preinstall_A.sh
│ │ │ ├── preinstall_B.sh
│ │ │ ├── rdiff
│ │ │ ├── sw-description-ab
│ │ │ ├── sw-description-ab-rdiff
│ │ │ ├── sw-description-recovery
│ │ │ ├── sw-subimgs-ab.cfg
│ │ │ ├── sw-subimgs-ab-rdiff.cfg
│ │ │ ├── sw-subimgs-recovery.cfg
│ │ │ ├── sys_partition_ab.fex
│ │ │ ├── sys_partition.fex // EMMC板型默认分区文件
│ │ │ ├── sys_partition_nor.fex
│ │ │ └── sys_partition-recovery.fex
│ │ ├── rp-lcd-lvds-10.1-1024-600.dtsi
│ │ ├── rp-lcd-lvds-10.1-1280-800.dtsi
│ │ ├── rp-lcd-lvds-7-1024-600.dtsi
│ │ ├── rp-lcd-tv-out.dtsi
│ │ ├── rp-t113-uboot.dts // EMMC板型uboot使用的dts文件
│ │ └── sys_config.fex // EMMC板型sys_config配置
│ ├── evb1_auto_nand
│ │ └── uboot-board.dts
│ └── evb1_auto_nor
└── tools
└── cardscript.fex
kernel
除了 modules 目录,以上目录结构跟标准的 linux 内核一致。modules 目录是我们用来存放没有跟内核的 menuconfig 集成的外部模块的地方。
t113_linux/kernel$ tree -L 2.
└── linux-5.4
├── abi_gki_whitelist
├── android
├── arch
├── block
├── build.config.aarch64
├── build.config.allmodconfig
├── build.config.allmodconfig.aarch64
├── build.config.allmodconfig.arm
├── build.config.allmodconfig.x86_64
├── build.config.arm
├── build.config.common
├── build.config.db845c
├── build.config.gki
├── build.config.gki.aarch64
├── build.config.gki-debug.aarch64
├── build.config.gki-debug.x86_64
├── build.config.gki_kasan
├── build.config.gki_kasan.aarch64
├── build.config.gki_kasan.x86_64
├── build.config.gki.x86_64
├── build.config.hikey960
├── build.config.x86_64
├── certs
├── COPYING
├── CREDITS
├── crypto
├── Documentation
├── drivers
├── fs
├── include
├── init
├── ipc
├── Kbuild
├── Kconfig
├── kernel
├── lib
├── LICENSES
├── linaro
├── MAINTAINERS
├── Makefile
├── mm
├── modules
├── net
├── README
├── README.md
├── rootfs_32bit.cpio.gz
├── rootfs.cpio.gz
├── samples
├── scripts
├── security
├── sound
├── tools
├── usr
└── virt
evb1_auto
evb1_auto -> device/config/chips/t113/configs/evb1_auto/
evb1_auto$ tree.
├── BoardConfig_rp-t113-buildroot.mk
├── board.dts -> linux-5.4/board.dts
├── bsp
│ ├── BoardConfig.mk
│ ├── boardConfig_nor.mk
│ ├── bootlogo.bmp
│ ├── env.cfg
│ ├── env_nor.cfg
│ ├── sys_partition.fex
│ └── sys_partition_nor.fex
├── linux-5.4
│ ├── board.dts
│ └── config-5.4
├── longan
│ ├── BoardConfig.mk
│ ├── boardConfig_nor.mk
│ ├── bootlogo.bmp
│ ├── env_ab.cfg
│ ├── env.cfg
│ ├── env_nor.cfg
│ ├── env-recovery.cfg
│ ├── postinstall_A.sh
│ ├── postinstall_B.sh
│ ├── preinstall_A.sh
│ ├── preinstall_B.sh
│ ├── rdiff
│ ├── sw-description-ab
│ ├── sw-description-ab-rdiff
│ ├── sw-description-recovery
│ ├── sw-subimgs-ab.cfg
│ ├── sw-subimgs-ab-rdiff.cfg
│ ├── sw-subimgs-recovery.cfg
│ ├── sys_partition_ab.fex
│ ├── sys_partition.fex
│ ├── sys_partition_nor.fex
│ └── sys_partition-recovery.fex
├── rp-lcd-lvds-10.1-1024-600.dtsi
├── rp-lcd-lvds-10.1-1280-800.dtsi
├── rp-lcd-lvds-7-1024-600.dtsi
├── rp-lcd-tv-out.dtsi
├── rp-t113-uboot.dts
└── sys_config.fex
platform
平台私有软件包目录
其中 rootfs 会在每次顶层执行 build.sh 的时候强制覆盖到 out 目录相应的 target 下(适用于EMMC 板型,target 为机器的根文件系统目录)
t113_linux/platform$ tree -L 2.
├── apps
│ ├── 4G-daemon // 4G 守护程序
│ ├── boot-play
│ ├── comtest
│ ├── demo
│ ├── io
│ ├── longan_info
│ ├── mediaplayer
│ └── mtop
├── base
│ ├── libawresample
│ ├── libspeex-lite
│ ├── libsys_info
│ └── resample
├── config
│ └── buildroot
├── core
│ ├── graphics
│ ├── multimedia
│ ├── net
│ └── system
├── external
│ └── libcutils
├── framework
│ ├── auto
│ ├── cairo
│ ├── cedarx
│ ├── libcedarc
│ ├── pixman
│ └── qt
└── tools
└── debug
test
test$ tree -L 3.
└── dragonboard
├── common
│ ├── adb
│ ├── rootfs
│ └── scripts
├── output
│ ├── data
│ └── fonts
└── src
├── build.sh
├── core
├── include
├── lib
├── Makefile
├── rule.mk
├── testcases
└── view
tools
编译打包工具,tools_win 是 PC 端烧录等工具目录
tools$ tree -L 2.
├── build
│ ├── allwinnerdst.awlic
│ ├── buildserver
│ └── top_build.sh
├── codecheck
│ ├── CloneAnalyzer
│ ├── cppcheck
│ ├── smatch
│ └── sparse
├── pack
│ └── pctools
└── tools_win
├── ALLWINNER_RNDIS_WINDOWS_DRIVER.rar
├── AndroidModify_V104_20120228.rar
├── BATCH-TOOL.rar
├── DebugView.zip
├── Documentations
├── FastbootWin32.zip
├── HerculesV100.rar
├── LiveSuitV306_For_Linux32.zip
├── LiveSuitV306_For_Linux64.zip
├── LogoGen.zip
├── OEMDataPacket_V108_20121227.rar
├── PhoenixCard_V4.1.9_20190227.zip
├── PhoenixSuit_CN_debug.msi
├── PhoenixSuit_CN.msi
├── phoenixsuit_V1.1.0_20150325.rar
├── PlatformTools.rar
├── platform-tools_v3db08f2c6889_20190708.7z
├── README.txt
├── UDISK_drivers.zip
├── USBDriver_64.zip
├── USBDriver.rar
└── USB_update_and_produce
out
t113_linux/out$ tree -L 2.
├── gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi
│ ├── arm-linux-gnueabi
│ ├── bin
│ ├── gcc-linaro-5.3.1-2016.05-linux-manifest.txt
│ ├── include
│ ├── lib
│ ├── libexec
│ └── share
├── kernel
│ ├── build
│ └── staging
├── pack_out
│ ├── arisc.fex -> ./../t113/evb1_auto/longan/arisc
│ ├── aultls32.fex
│ ├── aultools.fex
│ ├── battery_charge.bmp
│ ├── battery_charge.bmp.lzma
│ ├── bempty.bmp
│ ├── bempty.bmp.lzma
│ ├── board_config.bin
│ ├── board_config.fex
│ ├── BoardConfig.mk
│ ├── boardConfig_nor.mk
│ ├── BoardConfig_nor.mk
│ ├── board.fex
│ ├── boot0_nand.fex
│ ├── boot0_sdcard.fex
│ ├── boot0_spinor.fex
│ ├── boot.fex -> ./../t113/evb1_auto/longan/boot.img
│ ├── bootlogo.bmp
│ ├── bootlogo.bmp.lzma
│ ├── bootlogo.bmp.lzma.head
│ ├── bootlogo.fex -> bootlogo.bmp.lzma.head
│ ├── boot_package.cfg
│ ├── boot_package.fex
│ ├── boot_package_nor.cfg
│ ├── boot-resource
│ ├── boot-resource.fex
│ ├── boot-resource.ini
│ ├── cardscript.fex
│ ├── cardscript_secure.fex
│ ├── cardtool.fex
│ ├── config.fex
│ ├── default.awlic
│ ├── diskfs.fex
│ ├── dlinfo.fex
│ ├── dragon_toc.cfg
│ ├── dsp0.fex
│ ├── env_ab.cfg
│ ├── env_burn.cfg
│ ├── env.cfg
│ ├── env_dragon.cfg
│ ├── env.fex
│ ├── env_nor.cfg
│ ├── env-recovery.cfg
│ ├── esm.fex
│ ├── fes1.fex
│ ├── fit-image.its
│ ├── image.cfg
│ ├── image_crashdump.cfg
│ ├── image_linux.cfg
│ ├── image_nor.cfg
│ ├── kernel.fex -> ./../t113/evb1_auto/longan/uImage
│ ├── optee.fex
│ ├── parameter.fex
│ ├── postinstall_A.sh
│ ├── postinstall_B.sh
│ ├── preinstall_A.sh
│ ├── preinstall_B.sh
│ ├── rdiff
│ ├── rootfs.fex -> ./../t113/evb1_auto/longan/rootfs.ext4
│ ├── rootfs_nor.fex -> ./../t113/evb1_auto/longan/rootfs.squashfs
│ ├── rootfs-ubifs.fex -> ./../t113/evb1_auto/longan/rootfs.ubifs
│ ├── sboot.bin
│ ├── split_xxxx.fex
│ ├── sunxi.fex
│ ├── sunxi_gpt.fex
│ ├── sunxi_mbr.fex
│ ├── sw-description-ab
│ ├── sw-description-ab-rdiff
│ ├── sw-description-recovery
│ ├── sw-subimgs-ab.cfg
│ ├── sw-subimgs-ab-rdiff.cfg
│ ├── sw-subimgs-recovery.cfg
│ ├── sys_config.bin
│ ├── sys_config.fex
│ ├── sys_partition_ab.fex
│ ├── sys_partition.bin
│ ├── sys_partition_dump.fex
│ ├── sys_partition.fex
│ ├── sys_partition_nor.fex
│ ├── sys_partition_private.fex
│ ├── sys_partition-recovery.fex
│ ├── sysrecovery.fex
│ ├── toc0.fex
│ ├── toc1.fex
│ ├── u-boot-crash.fex
│ ├── u-boot.fex
│ ├── usbtool_crash.fex
│ ├── usbtool.fex
│ ├── usbtool_test.fex
│ ├── Vboot.fex
│ ├── Vboot-resource.fex
│ ├── Vdsp0.fex
│ ├── Venv.fex
│ ├── version_base.mk
│ ├── vmlinux.fex -> ./../t113/evb1_auto/longan/vmlinux.tar.bz2
│ └── Vrootfs.fex
├── serversocket
├── t113
│ └── evb1_auto
└── t113_linux_evb1_auto_uart0.img
编译命令
整体编译:
./build.sh && ./build.sh qt && ./build.sh pack
单独编译:
./build.sh brandy
./build.sh kernel
./build.sh buildroot
./build.sh qt
build.sh
#!/bin/bash
# Description:
# Allwinner compile tools usage
# We follow below step:
#
# To sun8i & linux-3.x developer:
#------------------------------------------------------------------------------------------------
# Using origin buildroot compile once, then not compile with reusable.
# Arch Kernel Out Dir
# sun8i Linux-3.x out/${chip}
#------------------------------------------------------------------------------------------------
#
# To mostly developer(sun50i|linux-4.x): using tools/build/mkcommon.sh
#------------------------------------------------------------------------------------------------
# Kernel Linux-3.x Linux-4.x
# Toolchain origin linaro-5.3
# Toolchain Dir external-toolchain gcc-linaro-5.3.1-2016.05
# Def Rootfs target_${ARCH}.tar.xz target-${ARCH}-linaro-5.3.tar.xz
# Out Dir out/${chip} out/${chip}-linaro-5.3
#
# To self design rootfs developer: using ${buildroot}/build/mkcommon.sh
#------------------------------------------------------------------------------------------------
# Kernel Linux-3.x Linux-4.x
# buildroot origin buildroot-201611
# Out Dir out/${chip} out/${chip}-linaro-5.3
#
# As self design rootfs developer, if not manager buildroot, please reference to buildroot manual
#
RP_CONFIG_DIR=device/config/chips/t113/configs/evb1_auto
RP_CONFIG_FILE=$RP_CONFIG_DIR/.BoardConfig.mk
function build_init()
{
TARGET_BOARD_ARRAY=( $(find $RP_CONFIG_DIR -name "BoardConfig_*" | sed 's#.*/##' | sort) )
echo "======you are building t113 linux======"
echo "${TARGET_BOARD_ARRAY[@]}" |xargs -n 1 | sed "=" | sed "N;s/\n/. /"
read -p "which board would you like: " INDEX
INDEX=$((${INDEX:-0} - 1))
BUILD_TARGET_BOARD="${TARGET_BOARD_ARRAY[$INDEX]}"
cp -f $RP_CONFIG_DIR/$BUILD_TARGET_BOARD $RP_CONFIG_FILE
echo -e "build target board configuration: $BUILD_TARGET_BOARD\n"
#select partition table
source $RP_CONFIG_FILE
echo "you board is ${DTS_NAME}"
}
[ -f out/kernel/build/arch/arm/boot/dts/${DTS_NAME}.dtb ] && rm out/kernel/build/arch/arm/boot/dts/${DTS_NAME}.dtb
if [ "x$1" == "xinit" ];then build_init && exit 0
else
[ ! -f $RP_CONFIG_FILE ] && build_init
source $RP_CONFIG_FILE
build/mkcommon.sh $@
fi
build/mkcomon.sh
#!/bin/bash
#
# scripts/mkcommon.sh
# (c) Copyright 2013
# Allwinner Technology Co., Ltd. <www.allwinnertech.com>
# James Deng <csjamesdeng@allwinnertech.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
export LC_ALL=C
BR_SCRIPTS_DIR=$(cd $(dirname $0) && pwd)
BUILD_CONFIG=$BR_SCRIPTS_DIR/../.buildconfig
SKIP_BR=0
# source shflags
source ${BR_SCRIPTS_DIR}/shflags
if [ -f ${BUILD_CONFIG} ]; then
. ${BUILD_CONFIG}
LICHEE_TOP_DIR_NEW=$(cd $BR_SCRIPTS_DIR/.. && pwd)
if [ "$LICHEE_TOP_DIR_NEW" != "$LICHEE_TOP_DIR" ]; then sed -i "s|$LICHEE_TOP_DIR|$LICHEE_TOP_DIR_NEW|g" ${BUILD_CONFIG}
. ${BUILD_CONFIG}
fi fi
# define option, format:
# 'long option' 'default value' 'help message' 'short option'
# WARN: Don't modify default value, because we will check it later
DEFINE_string 'ic' '' 'ic to build, e.g. V316' 'i'
DEFINE_string 'kernel' '' 'Kernel to build, e.g. 3.3' 'k'
DEFINE_string 'board' '' 'Board to build, e.g. evb' 'b'
DEFINE_string 'flash' 'default' 'flash to build, e.g. nor' 'n'
DEFINE_string 'os' '' 'os to build, e.g. android bsp' 'o'
DEFINE_string 'module' 'all' 'Module to build, e.g. buildroot, kernel, uboot, clean' 'm'
DEFINE_boolean 'config' false 'Config compile platfom' 'c'
DEFINE_boolean 'force' false 'Force to build, clean some old files. ex, rootfs/' 'f'
FLAGS_HELP="Top level build script for lichee Examples: 1. Build lichee, it maybe config platform options, if you first use it. And it will pack firmware use default argument. $ ./build.sh 2. Configurate platform option $ ./build.sh config 3. Autoconfigurete $ ./build.sh autoconfig -i V316 -o bsp -n nor -b perf1 4. Pack linux, dragonboard image $ ./build.sh pack[_<option>] e.g. debug, dump, prvt, verity 5. Build lichee using command argument $ ./build.sh -i <ic> e.g. V316 6. Build module using command argument $ ./build.sh -m <module> 7. Build special kernel $ ./build.sh -k <kernel directly> 8. Build forcely to clean rootfs dir $ ./build.sh -f "
# Include base command!
source ${BR_SCRIPTS_DIR}/mkcmd.sh
# parse the command-line
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
ic=${FLAGS_ic}
platform=${FLAGS_os}
kernel=${FLAGS_kernel}
board=${FLAGS_board}
flash=${FLAGS_flash}
module=${FLAGS_module}
config=${FLAGS_config}
force=""
################ Preset an empty command #################
function nfunc(){
echo "Begin Action"
}
ACTION=":;"
################ Parse other arguments ###################
while [ $# -gt 0 ]; do case "$1" in config*)
opt=${1##*_};
if [ "${opt}" == "all" ]; then export CONFIG_ALL=${FLAGS_TRUE};
else export CONFIG_ALL=${FLAGS_FALSE};
fi FLAGS_config=${FLAGS_TRUE};
break;
;;
autoconfig)
ACTION="mk_autoconfig;"
FLAGS_config=${FLAGS_TRUE};
break;
;;
loadconfig|menuconfig|saveconfig|mergeconfig) # support t113 compile(linux5.4)
ACTION="kernel_config $@;"
module=""
;;
gen*)
opt=${1##*_};
if [ "${opt}" == "config" ]; then cd kernel/${LICHEE_KERN_VER}/
printf "\033[47;41mPrepare to use script to generate the android defconfig.\033[0m\n"
ARCH=${LICHEE_ARCH} ./scripts/kconfig/merge_config.sh \
arch/${LICHEE_ARCH}/configs/${LICHEE_CHIP}smp_defconfig \
kernel/configs/android-base.config \
kernel/configs/android-recommended.config \
kernel/configs/sunxi-recommended.config
if [ -f .config ]; then printf "\033[47;41mComplete the build config,save to ${LICHEE_KERN_VER}/.config !!!\033[0m\n"
cp .config arch/${LICHEE_ARCH}/configs/${LICHEE_CHIP}smp_android_defconfig
fi cd ..
exit 0
else echo "Do not support this command!!"
exit 1
fi break;
;;
pack*)
optlist=$(echo ${1#pack} | sed 's/_/ /g')
mode=""
for opt in $optlist; do case "$opt" in debug)
mode="$mode -d card0"
;;
dump)
mode="$mode -m dump"
;;
prvt)
mode="$mode -f prvt"
;;
secure)
mode="$mode -s secure"
;;
prev)
mode="$mode -s prev_refurbish"
;;
crash)
mode="$mode -m crashdump"
;;
vsp)
mode="$mode -t vsp"
;;
raw)
mode="$mode -w programmer"
;;
verity)
mode="$mode --verity"
;;
signfel)
mode="$mode --signfel"
;;
*)
mk_error "Invalid pack option $opt"
exit 1
;;
esac
done
######### Don't build other module, if pack firmware ########
ACTION="mkpack ${mode};";
module="";
break;
;;
buildroot)
ACTION="mkbr;";
module=buildroot;
break;
;;
qt)
ACTION="mkqt;";
module="";
break;
;;
ramfs)
ACTION="mkramfs;";
module=ramfs;
break;
;;
clean|distclean|rootfs)
ACTION="mk${1};";
module="";
break;
;;
bootloader)
ACTION="mk${1};";
module="bootloader";
break;
;;
brandy)
ACTION="mk${1};";
module="brandy";
break;
;;
kernel)
ACTION="mkkernel;";
module="kernel";
break;
;;
recovery)
ACTION="mkrecovery;";
module="recovery";
break;
;;
dts)
ACTION="mkdts;";
module="";
break
;;
*) ;;
esac;
shift;
done
# if not .buildconfig or FLAGS_config equal FLAGS_TRUE, then mksetup.sh & exit
if [ ! -f ${BUILD_CONFIG} -o ${FLAGS_config} -eq ${FLAGS_TRUE} ]; then
#
# If we do config, it must be clean the old env var.
#
clean_old_env_var
if [ "x$1" == "xautoconfig" ]; then tmp=${flash}
source ${BR_SCRIPTS_DIR}/mkcmd.sh
mk_autoconfig ${ic} ${platform} ${board} ${tmp} ${kernel}
exit 0;
fi
. ${BR_SCRIPTS_DIR}/mksetup.sh
if [ ${FLAGS_config} -eq ${FLAGS_TRUE} ]; then exit 0;
fi fi if [ ${FLAGS_force} -eq ${FLAGS_TRUE} ]; then force="f";
fi
# mkdir output dir
check_output_dir
############### Append ',' end character #################
module="${module},"
while [ -n "${module}" ]; do act=${module%%,*};
case ${act} in all*)
ACTION="mklichee;";
module="";
break;
;;
uboot)
ACTION="${ACTION}mkboot;";
;;
clean)
ACTION="mkclean;";
module="";
;;
distclean)
ACTION="distclean;";
module="";
;;
esac
module=${module#*,};
done
#
# Execute the action list.
#
echo "ACTION List: ${ACTION}========"
action_exit_status=$?
while [ -n "${ACTION}" ]; do act=${ACTION%%;*};
echo "Execute command: ${act} ${force}"
${act} ${force}
action_exit_status=$?
ACTION=${ACTION#*;};
done exit ${action_exit_staus}