From df29a9eab03f8a7bd78582f1f06705bc054cf15a Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Fri, 24 May 2024 16:21:42 +0900 Subject: [PATCH 01/13] telechips: Add script for boot-firmware model: tcc807x Signed-off-by: Steve Jeong --- telechips/boot-firmware/mksd.sh | 153 ++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100755 telechips/boot-firmware/mksd.sh diff --git a/telechips/boot-firmware/mksd.sh b/telechips/boot-firmware/mksd.sh new file mode 100755 index 0000000..ffdb3af --- /dev/null +++ b/telechips/boot-firmware/mksd.sh @@ -0,0 +1,153 @@ +#!/bin/bash + +# This script must exist in root-path of 'boot-firmware/' +# written by Steve Jeong (steve@how2flow.net) + +set -x + +CHIP=("tcc807x") +K_VER="5.10" +KERNEL="${HOME}/kernel/kernel-${K_VER}/" +UBOOT="${HOME}/u-boot/u-boot-core/" + +cherrypick() { + local cherry + + cherry=$(find ${1} -name ${2} | grep ${3}) + + echo ${cherry} +} + +cherrynpick() { + local cherry + + cherry=$(find ${1} -name ${2} | grep -v ${3}) + + echo ${cherry} +} + +create_gpt_partition_list() { + local target + + target=${1} + + case ${target} in + tcc807x) + cat << __EOF > tools/mktcimg/gpt_partition.list +bl3_ap0_a:2048k@../ap0_bl3.rom +bl3_ap0_b:2048k@../ap0_bl3.rom +bl3_ap1_a:2048k@../ap1_bl3.rom +bl3_ap1_b:2048k@../ap1_bl3.rom +boot:40960k@../boot.img +dtb:1024k@../tcc8070-lpd4x322.dtb +misc:1024k@ +env:16k@ +subcore_boot:40960k@../boot_sub.img +subcore_dtb:1024k@../tcc8070-subcore-lpd4x322.dtb +subcore_misc:1024k@ +subcore_env:16k@ +data:0k@ +__EOF +sleep .5 + ;; + esac +} + +create_symlink() { + local data + local dtb_main + local dtb_sub + local idx + local kernel_main + local kernel_sub + local line + local path + local root_path + local target + local uboot + + data=$(cat tools/mktcimg/gpt_partition.list) + root_path=$(pwd -P) + cd tools/mktcimg/ + + for line in ${data}; do + idx=${line%%:*} + path=${line#*@} + target=${line#*/} + + if [ -z ${path} ]; then + continue + fi + + # u-boot: main is different with sub + if [ $(echo ${idx} | grep "bl" | wc -l) -gt 0 ]; then + uboot=$(cherrypick ${UBOOT} ${target} "build") + [ ! -f ${uboot} ] && echo "There is no ${target} in ${UBOOT}" + [ ! -f ${path} ] && ln -s ${uboot} ${path} + # kernel: main is equal with sub + elif [ $(echo ${idx} | grep "boot" | wc -l) -gt 0 ]; then + # kernel-sub + if [ $(echo ${idx} | grep "sub" | wc -l) -eq 1 ]; then + kernel_sub=$(cherrypick ${KERNEL} ${target/_sub/} "build_sub") + mv ${kernel_sub} ${kernel_sub/boot/boot_sub/} + [ ! -f ${kernel_sub} ] && echo "There is no ${target} in ${KERNEL}" + [ ! -f ${path} ] && ln -s ${kernel_sub} ${path} + # kernel-main + else + kernel_main=$(cherrynpick ${KERNEL} ${target} "build_sub") + [ ! -f ${kernel_main} ] && echo "There is no ${target} in ${KERNEL}" + [ ! -f ${path} ] && ln -s ${kernel_main} ${path} + fi + # dtb: main is equal with sub + elif [ $(echo ${idx} | grep "dtb" | wc -l) -gt 0 ]; then + # dtb-sub + if [ $(echo ${idx} | grep "sub" | wc -l) -eq 1 ]; then + dtb_sub=$(cherrypick ${KERNEL} ${target/_sub/} "build_sub") + [ ! -f ${dtb_sub} ] && echo "There is no ${target} in ${KERNEL}" + [ ! -f ${path} ] && ln -s ${dtb_sub} ${path} + # dtb-main + else + dtb_main=$(cherrynpick ${KERNEL} ${target} "build_sub") + [ ! -f ${dtb_main} ] && echo "There is no ${target} in ${KERNEL}" + [ ! -f ${path} ] && ln -s ${dtb_main} ${path} + fi + fi + + done + + cd ${root_path} +} + +make_sd() { + local root_path + local target + + root_path=$(pwd -P) + target=${1} + + cd tools/mktcimg/ + case ${target} in + ufs) # ufs + ./mktcimg --parttype gpt --storage_size 63988301824 --fplist gpt_partition.list --outfile SD_Data.fai --area_name "SD Data" --gptfile SD_Data.gpt --sector_size 4096 + mv SD_Data* ${root_path} + ;; + *) # mmc + ./mktcimg --parttype gpt --storage_size 31268536320 --fplist gpt_partition.list --outfile SD_Data.fai --area_name "SD Data" --gptfile SD_Data.gpt + mv SD_Data* ${root_path} + ;; + esac + + cd ${root_path} +} + +echo "=== Select Chip model ===" +for ((i=0; i<${CHIP[@]}+1; i++)); do + echo "[${i+1}] ${CHIP[$i]}" +done + +read -r -p "CHIP: " opt + +create_gpt_partition_list ${CHIP[$(expr ${opt} - 1)]} +create_symlink +sleep 3 +make_sd From 22d60cc3a6c4d6948cbca544d256d96e36ca35b5 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Fri, 24 May 2024 16:43:20 +0900 Subject: [PATCH 02/13] telechips: Add fwdn script of window power shell model: tcc807x Signed-off-by: Steve Jeong --- telechips/fwdn/FlashData_tcc807x.ps1 | 34 ++++++++++++++++++++++++++++ telechips/fwdn/file-tree | 12 ++++++++++ 2 files changed, 46 insertions(+) create mode 100644 telechips/fwdn/FlashData_tcc807x.ps1 create mode 100644 telechips/fwdn/file-tree diff --git a/telechips/fwdn/FlashData_tcc807x.ps1 b/telechips/fwdn/FlashData_tcc807x.ps1 new file mode 100644 index 0000000..0ab1d68 --- /dev/null +++ b/telechips/fwdn/FlashData_tcc807x.ps1 @@ -0,0 +1,34 @@ +# This file is for window power shell script +# Need to change LF to CRLF +# related packages: dos2unix, unix2dos +# written by Steve Jeong (steve@how2flow.net) + +# Define the path to fwdn.exe +$fwdnExecutable = ".\fwdn.exe" + +# Define the directory path +$directoryPath = "Z:\boot-firmware" + +# Search for all files ending with fwdn.json and boot.json +$fwdnFiles = Get-ChildItem -Path $directoryPath -Filter "*fwdn.json" +$bootFiles = Get-ChildItem -Path $directoryPath -Filter "*boot.json" + +# Execute fwdn.json files +foreach ($file in $fwdnFiles) { + Write-Host "Executing file: $($file.FullName) (command: --fwdn)" + & $fwdnExecutable --fwdn $file.FullName +} + +# Execute boot.json files +foreach ($file in $bootFiles) { + Write-Host "Executing file: $($file.FullName) (command: --write)" + & $fwdnExecutable --write $file.FullName +} + +# Execute additional command +$additionalFile = "Z:\boot-firmware\SD_Data.fai" +$storageType = "emmc" +$storageArea = "user" + +Write-Host "Executing additional command: $additionalFile (command: --write --storage $storageType --area $storageArea)" +& $fwdnExecutable --write $additionalFile --storage $storageType --area $storageArea diff --git a/telechips/fwdn/file-tree b/telechips/fwdn/file-tree new file mode 100644 index 0000000..c649c4e --- /dev/null +++ b/telechips/fwdn/file-tree @@ -0,0 +1,12 @@ +└── Window (C:) + ├── samba (Z:) +    ├── boot-firmware/ + ├── fwnd.json + ├── boot.json + ├── SD_Data.fai + ├── SD_Data.gpt + ├── SD_Data.gpt.back + ├── SD_Data.gpt.prim + ├── ... + ├── tools/ + ├── ... From e3ff700a185219216f8e4f046ba97ad7bf8dbb36 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 09:29:49 +0900 Subject: [PATCH 03/13] telechips: Improve mksd for tcc807x Signed-off-by: Steve Jeong --- telechips/boot-firmware/mksd.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/telechips/boot-firmware/mksd.sh b/telechips/boot-firmware/mksd.sh index ffdb3af..68fd6ed 100755 --- a/telechips/boot-firmware/mksd.sh +++ b/telechips/boot-firmware/mksd.sh @@ -3,7 +3,7 @@ # This script must exist in root-path of 'boot-firmware/' # written by Steve Jeong (steve@how2flow.net) -set -x +#set -x CHIP=("tcc807x") K_VER="5.10" @@ -83,20 +83,19 @@ create_symlink() { if [ $(echo ${idx} | grep "bl" | wc -l) -gt 0 ]; then uboot=$(cherrypick ${UBOOT} ${target} "build") [ ! -f ${uboot} ] && echo "There is no ${target} in ${UBOOT}" - [ ! -f ${path} ] && ln -s ${uboot} ${path} + rm -rf ${path} && ln -s ${uboot} ${path} # kernel: main is equal with sub elif [ $(echo ${idx} | grep "boot" | wc -l) -gt 0 ]; then # kernel-sub if [ $(echo ${idx} | grep "sub" | wc -l) -eq 1 ]; then - kernel_sub=$(cherrypick ${KERNEL} ${target/_sub/} "build_sub") - mv ${kernel_sub} ${kernel_sub/boot/boot_sub/} - [ ! -f ${kernel_sub} ] && echo "There is no ${target} in ${KERNEL}" - [ ! -f ${path} ] && ln -s ${kernel_sub} ${path} + kernel_sub=$(cherrypick ${KERNEL} Image "build_sub") + [ ! -f ${kernel_sub} ] && echo "There is no Image in ${KERNEL}" + rm -rf ${path} && ln -s ${kernel_sub} ${path} # kernel-main else - kernel_main=$(cherrynpick ${KERNEL} ${target} "build_sub") - [ ! -f ${kernel_main} ] && echo "There is no ${target} in ${KERNEL}" - [ ! -f ${path} ] && ln -s ${kernel_main} ${path} + kernel_main=$(cherrynpick ${KERNEL} Image "build_sub") + [ ! -f ${kernel_main} ] && echo "There is no Image in ${KERNEL}" + rm -rf ${path} && ln -s ${kernel_main} ${path} fi # dtb: main is equal with sub elif [ $(echo ${idx} | grep "dtb" | wc -l) -gt 0 ]; then @@ -104,12 +103,12 @@ create_symlink() { if [ $(echo ${idx} | grep "sub" | wc -l) -eq 1 ]; then dtb_sub=$(cherrypick ${KERNEL} ${target/_sub/} "build_sub") [ ! -f ${dtb_sub} ] && echo "There is no ${target} in ${KERNEL}" - [ ! -f ${path} ] && ln -s ${dtb_sub} ${path} + rm -rf ${path} && ln -s ${dtb_sub} ${path} # dtb-main else dtb_main=$(cherrynpick ${KERNEL} ${target} "build_sub") [ ! -f ${dtb_main} ] && echo "There is no ${target} in ${KERNEL}" - [ ! -f ${path} ] && ln -s ${dtb_main} ${path} + rm -rf ${path} && ln -s ${dtb_main} ${path} fi fi From 8ec3ad3a888f64c7f3889256c6c2553efa53f40b Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 09:43:17 +0900 Subject: [PATCH 04/13] telechips: Add do_crosscompile Signed-off-by: Steve Jeong --- telechips/do_crosscompile | 139 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100755 telechips/do_crosscompile diff --git a/telechips/do_crosscompile b/telechips/do_crosscompile new file mode 100755 index 0000000..cb0876d --- /dev/null +++ b/telechips/do_crosscompile @@ -0,0 +1,139 @@ +#!/bin/bash + +# Copyright (C) 2024 Steve Jeong +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see + +set -e + +# declare +declare -A CCList +CCList["arm"]="arm-linux-gnueabi-" +CCList["armhf"]="arm-linux-gnueabihf-" +CCList["arm64"]="aarch64-linux-gnu-" +CCList["x86"]="x86-64-linux-gnu-" + +help_msg() { + local msg="" + + case ${1} in + arch) + msg="e.g 'arm64' or 'x86' or ..." + ;; + config) + msg="e.g 'i386_defconfig' or 'oldconfig' or ..." + ;; + *) + ;; + esac + + echo "" + echo "[kernel ${1}]" + echo "${msg}" +} + +check_kernel_root() { + if [[ ! -d arch || ! -d init ]]; then + echo "Make sure you are currently in the path of the kernel root!" + exit 1 + else + ROOT=$(pwd -P) + fi +} + +request() { + local key="" + local params="" + + cd ${1} + while true; do + read -e -p "Input ${1}: " params + for param in ${params}; do + key=$(find ${ROOT}/${1} -name "${param/armhf/arm}" | wc -l) + if [[ ${key} -gt 0 || "x${param}" = "xoldconfig" ]]; then + continue + fi + key="invalid" + done + + [ "x${key}" != "xinvalid" ] && break + done + + cd ${ROOT} + + echo ${params} +} + +set_target() { + local option="" + local ret="" + + echo "" + echo "If it's your first build, you must do the build all.." + read -r -p "What do you wan't build? (all/dtbs/modules)? [A/d/m]: " option + case ${option} in + [dD][tT][bB][sS]|[dD]) + ret="dtbs" + ;; + [mM][oO][dD][uU][lL][eE][sS]|[mM]) + ret="modules" + ;; + *) + ret="all" + ;; + esac + + echo ${ret} +} + +main() { + local arch="" + local cc="" # cross-compiler + local config="" + local ret="" + local target="" + + # Verify that the current working path is the root of the kernel source. + check_kernel_root + + # config target's architecture + help_msg "arch" + ret=$(request "arch" | tail -n 1) + arch=${ret/armhf/arm} + cc=${CCList[${ret}]} + + # config target's configs + help_msg "config" + ret=$(request "arch/${arch}/configs" | tail -n 1) + config=${ret} + + target=$(set_target | tail -n 1) + export ARCH=${arch} + export CROSS_COMPILE=${cc} + if [[ ${config} == *"sub"* ]]; then + export KBUILD_OUTPUT=./build_sub + else + export KBUILD_OUTPUT=./build + fi + + # build + echo "make ARCH=${arch} ${config}" + make ${config} + echo "make ARCH=${arch} CROSS_COMPILE=${cc} ${target} -j$(nproc)" + make ${target} -j$(nproc) +} + +main + +# vim: ft=sh ts=2 sw=2 sts=2 et From dea25c314e50a729ddcc6be1f6aa191926f2a964 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 10:13:35 +0900 Subject: [PATCH 05/13] fwdn: Fix error of flash image 'When writing FAI files without low-format, there may be garbage values in partition where data is not written.' Absence of a script to create an image in the kernel Signed-off-by: Steve Jeong --- telechips/boot-firmware/mksd.sh | 9 +++++---- telechips/{ => script}/do_crosscompile | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) rename telechips/{ => script}/do_crosscompile (99%) diff --git a/telechips/boot-firmware/mksd.sh b/telechips/boot-firmware/mksd.sh index 68fd6ed..88074db 100755 --- a/telechips/boot-firmware/mksd.sh +++ b/telechips/boot-firmware/mksd.sh @@ -88,13 +88,14 @@ create_symlink() { elif [ $(echo ${idx} | grep "boot" | wc -l) -gt 0 ]; then # kernel-sub if [ $(echo ${idx} | grep "sub" | wc -l) -eq 1 ]; then - kernel_sub=$(cherrypick ${KERNEL} Image "build_sub") - [ ! -f ${kernel_sub} ] && echo "There is no Image in ${KERNEL}" + kernel_sub=$(cherrypick ${KERNEL} ${target/_sub/} "build_sub") + mv ${kernel_sub} ${kernel_sub/boot/boot_sub/} + [ ! -f ${kernel_sub} ] && echo "There is no ${target} in ${KERNEL}" rm -rf ${path} && ln -s ${kernel_sub} ${path} # kernel-main else - kernel_main=$(cherrynpick ${KERNEL} Image "build_sub") - [ ! -f ${kernel_main} ] && echo "There is no Image in ${KERNEL}" + kernel_main=$(cherrynpick ${KERNEL} ${target} "build_sub") + [ ! -f ${kernel_main} ] && echo "There is no ${target} in ${KERNEL}" rm -rf ${path} && ln -s ${kernel_main} ${path} fi # dtb: main is equal with sub diff --git a/telechips/do_crosscompile b/telechips/script/do_crosscompile similarity index 99% rename from telechips/do_crosscompile rename to telechips/script/do_crosscompile index cb0876d..40d8830 100755 --- a/telechips/do_crosscompile +++ b/telechips/script/do_crosscompile @@ -132,6 +132,7 @@ main() { make ${config} echo "make ARCH=${arch} CROSS_COMPILE=${cc} ${target} -j$(nproc)" make ${target} -j$(nproc) + ./mklinuxmtdimg_64bit.sh } main From 2dc8c7481a40bcab13811be3d810b5a0168c56c6 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 10:41:38 +0900 Subject: [PATCH 06/13] telechips: Add flash uboot script for telechips boards Signed-off-by: Steve Jeong --- telechips/kernel-script | 67 ++++++++++++++++++++++++++++++++++ telechips/script/do_flashuboot | 46 +++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100755 telechips/kernel-script create mode 100755 telechips/script/do_flashuboot diff --git a/telechips/kernel-script b/telechips/kernel-script new file mode 100755 index 0000000..f8dc137 --- /dev/null +++ b/telechips/kernel-script @@ -0,0 +1,67 @@ +#!/bin/bash + +# Copyright (C) 2024 Steve Jeong +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see + +DEFAULT="~/.usr/share/kernel-scripts" +PREFIX=${CHECKOUT:-${DEFAULT}} + +options=$(getopt -o cfhil -l crosscompile,ftrace,help,install,losetup -- "$@") +eval set -- "${options}" + +Usage() { + echo "Usage: kernel-script [OPTIONS]" + echo "Options:" + echo " -c, --crosscompile Perform a cross-compilation of the kernel" + echo " -f, --ftrace Run ftrace with kernel APIs" + echo " need root permission" + echo " -l, --losetup Losetup in loop devices" + echo " need root permission" + echo " --help Display this help message" + exit 0 +} + +while true; do + case "$1" in + -c|--crosscompile) + . "${PREFIX}"/do_crosscompile + exit 0 + ;; + -f|--ftrace) + . "${PREFIX}"/do_ftrace + exit 0 + ;; + -h|--help) + Usage + ;; + -l|--losetup) + . "${PREFIX}"/do_losetup + exit 0 + ;; + -u|--uboot) + . "${PREFIX}"/do_flashuboot + exit 0 + ;; + --) shift + break + ;; + *) + echo "Not implemented: $1" >&2 + ;; + esac + shift +done + +# vim: set ft=sh ts=2 sw=2 sts=2 et diff --git a/telechips/script/do_flashuboot b/telechips/script/do_flashuboot new file mode 100755 index 0000000..c88fd57 --- /dev/null +++ b/telechips/script/do_flashuboot @@ -0,0 +1,46 @@ +#!/bin/bash + +check_uboot_root() { + if [[ ! -d arch || ! -d board ]]; then + echo "" + exit 1 + else + ROOT=$(pwd -P) + fi +} + +main () { + check_uboot_root + cd ${ROOT} + + echo "build uboot for main-core" + . scripts/envsetup.sh << __EOF +1 +4 +1 +__EOF + +make tcc807x_defconfig telechips_mmc_boot.config +make -j12 + +sleep 3 + +} + +sub() { + check_uboot_root + cd ${ROOT} + + echo "build uboot for sub-core" + . scripts/envsetup.sh << __EOF +1 +4 +2 +__EOF + +make tcc807x_subcore_defconfig telechips_mmc_boot.config +make -j12 +} + +main +sub From 773d252b6ba922a2affd22f2bc5c0defa080f1ac Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 10:48:31 +0900 Subject: [PATCH 07/13] telechips/kernel-script: Fix error of prefix change '~' to $HOME Signed-off-by: Steve Jeong --- telechips/kernel-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telechips/kernel-script b/telechips/kernel-script index f8dc137..4169c6b 100755 --- a/telechips/kernel-script +++ b/telechips/kernel-script @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see -DEFAULT="~/.usr/share/kernel-scripts" +DEFAULT="${HOME}/.usr/share/kernel-scripts" PREFIX=${CHECKOUT:-${DEFAULT}} options=$(getopt -o cfhil -l crosscompile,ftrace,help,install,losetup -- "$@") From 73d7e439206b2bfdc8e47c47645d0416379dba89 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 11:26:17 +0900 Subject: [PATCH 08/13] teelchips/mksd: Troubleshooting Errors for Continuous Use Signed-off-by: Steve Jeong --- telechips/boot-firmware/mksd.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/telechips/boot-firmware/mksd.sh b/telechips/boot-firmware/mksd.sh index 88074db..95d49e4 100755 --- a/telechips/boot-firmware/mksd.sh +++ b/telechips/boot-firmware/mksd.sh @@ -88,8 +88,12 @@ create_symlink() { elif [ $(echo ${idx} | grep "boot" | wc -l) -gt 0 ]; then # kernel-sub if [ $(echo ${idx} | grep "sub" | wc -l) -eq 1 ]; then + kernel_sub=$(cherrypick ${KERNEL} ${target} "build_sub") + if [ -z ${kernel_sub} ]; then kernel_sub=$(cherrypick ${KERNEL} ${target/_sub/} "build_sub") - mv ${kernel_sub} ${kernel_sub/boot/boot_sub/} + mv ${kernel_sub} ${kernel_sub/.img/_sub.img} + kernel_sub=${kernel_sub/.img/_sub.img} + fi [ ! -f ${kernel_sub} ] && echo "There is no ${target} in ${KERNEL}" rm -rf ${path} && ln -s ${kernel_sub} ${path} # kernel-main From b5e46d8ff1efd4716fa6d92a0fff3258925a611c Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 11:48:16 +0900 Subject: [PATCH 09/13] telechips: Rename dir script -> scripts Signed-off-by: Steve Jeong --- telechips/{script => scripts}/do_crosscompile | 0 telechips/{script => scripts}/do_flashuboot | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename telechips/{script => scripts}/do_crosscompile (100%) rename telechips/{script => scripts}/do_flashuboot (100%) diff --git a/telechips/script/do_crosscompile b/telechips/scripts/do_crosscompile similarity index 100% rename from telechips/script/do_crosscompile rename to telechips/scripts/do_crosscompile diff --git a/telechips/script/do_flashuboot b/telechips/scripts/do_flashuboot similarity index 100% rename from telechips/script/do_flashuboot rename to telechips/scripts/do_flashuboot From d18404ea91b94993d4d323b6166fc415decf2475 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 13 Jun 2024 11:48:43 +0900 Subject: [PATCH 10/13] telechips: Add README Signed-off-by: Steve Jeong --- telechips/README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 telechips/README.md diff --git a/telechips/README.md b/telechips/README.md new file mode 100644 index 0000000..6cdbfd8 --- /dev/null +++ b/telechips/README.md @@ -0,0 +1,63 @@ +# For telechips boards build scripts + + +### Guide + +1. 커스텀 커맨드 경로 설정 +``` +$ echo "export PATH=$HOME/.usr/bin:$PATH" >> ${HOME}/.profile +``` +``` +$ mkdir -p ${HOME}/.usr/bin +$ mkdir -p ${HOME}/.usr/share +``` +
+ +2. kernel-script 다운로드 +``` +$ git clone https://github.com/how2flow/kernel-scripts -b telechips +$ cp kernel-scripts/telechips/kernel-script ${HOME}/.usr/bin/kernel-script +$ cp kernel-scripts/telechips/scripts/* ${HOME}/.usr/share/kernel-scripts/ +``` +
+ +3. boot-firmware 세팅 + +``` +$ cd ${HOME} +$ git clone {boot-firmware repo} -b "타겟 보드(tcc807x / ..)" +$ cp kernel-scripts/telechips/boot-firmware/mksd.sh ${HOME}/boot-firmware +``` +
+ +4. ps1 파일 설정 +``` +kernel-scripts/telechips/fwdn/file-tree 참조 +``` +
+ +5. uboot / kernel 파일 트리 +
+ +u-boot +``` +~/u-boot/u-boot-core$ tree -L 1 +├── api +├── arch +├── board +├── boot +... +``` +
+ +kernel +``` +~/kernel$ tree -L 1 +. +├── initramfs64.cpio.lzo +├── initramfs.cpio.lzo +├── kernel-5.10 + `initramfs64.cpio.lzo -> ../initramfs64.cpio.lzo +... +``` +
From 8aa0f2a4c6e70615b7beb444338af59bd58b80fd Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Wed, 10 Jul 2024 11:30:07 +0900 Subject: [PATCH 11/13] telechips/mksd: Improve file pick mechanism For flexible build paths Signed-off-by: Steve Jeong --- telechips/boot-firmware/mksd.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/telechips/boot-firmware/mksd.sh b/telechips/boot-firmware/mksd.sh index 95d49e4..f683061 100755 --- a/telechips/boot-firmware/mksd.sh +++ b/telechips/boot-firmware/mksd.sh @@ -13,7 +13,10 @@ UBOOT="${HOME}/u-boot/u-boot-core/" cherrypick() { local cherry - cherry=$(find ${1} -name ${2} | grep ${3}) + cherry=$(find ${1} -name ${2}) + if [ -z ${cherry} ]; then + cherry=$(find ${1} -name ${2} | grep ${3}) + fi echo ${cherry} } @@ -22,6 +25,9 @@ cherrynpick() { local cherry cherry=$(find ${1} -name ${2} | grep -v ${3}) + if [ -z ${cherry} ]; then + cherry=$(find ${1} -name ${2}) + fi echo ${cherry} } From 6fe6552fffc98b855e710c188a453c1f8c613958 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Thu, 11 Jul 2024 14:07:46 +0900 Subject: [PATCH 12/13] squash! telechips/mksd: Improve file pick mechanism Signed-off-by: Steve Jeong --- telechips/boot-firmware/mksd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telechips/boot-firmware/mksd.sh b/telechips/boot-firmware/mksd.sh index f683061..70d7c68 100755 --- a/telechips/boot-firmware/mksd.sh +++ b/telechips/boot-firmware/mksd.sh @@ -13,9 +13,9 @@ UBOOT="${HOME}/u-boot/u-boot-core/" cherrypick() { local cherry - cherry=$(find ${1} -name ${2}) + cherry=$(find ${1} -name ${2} | grep ${3}) if [ -z ${cherry} ]; then - cherry=$(find ${1} -name ${2} | grep ${3}) + cherry=$(find ${1} -name ${2}) fi echo ${cherry} From 97add8cfcde4cf17a589223d57afc738e670ef13 Mon Sep 17 00:00:00 2001 From: Steve Jeong Date: Fri, 26 Jul 2024 14:21:08 +0900 Subject: [PATCH 13/13] telechips/boot-firmware: mksd: Add tcc897x Signed-off-by: Steve Jeong --- telechips/boot-firmware/mksd.sh | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/telechips/boot-firmware/mksd.sh b/telechips/boot-firmware/mksd.sh index 70d7c68..f7a549b 100755 --- a/telechips/boot-firmware/mksd.sh +++ b/telechips/boot-firmware/mksd.sh @@ -5,7 +5,7 @@ #set -x -CHIP=("tcc807x") +CHIP=("tcc807x" "tcc897x") K_VER="5.10" KERNEL="${HOME}/kernel/kernel-${K_VER}/" UBOOT="${HOME}/u-boot/u-boot-core/" @@ -54,7 +54,24 @@ subcore_misc:1024k@ subcore_env:16k@ data:0k@ __EOF -sleep .5 + UFS_SIZE=63988301824 + MMC_SIZE=31268536320 + sleep .5 + ;; + tcc897x) + cat << __EOF > tools/mktcimg/gpt_partition.list +bl3_ca7_a:2048k@../ca7_bl3.rom +bl3_ca7_b:2048k@../ca7_bl3.rom +boot:49152k@../boot.img +dtb:1024k@../tcc8971-lcn.dtb +env:1024k@ +misc:1024k@ +data:0k@ +__EOF +#7818182656 +#15636365312 + MMC_SIZE=7818182656 + sleep .5 ;; esac } @@ -138,11 +155,11 @@ make_sd() { cd tools/mktcimg/ case ${target} in ufs) # ufs - ./mktcimg --parttype gpt --storage_size 63988301824 --fplist gpt_partition.list --outfile SD_Data.fai --area_name "SD Data" --gptfile SD_Data.gpt --sector_size 4096 + ./mktcimg --parttype gpt --storage_size ${UFS_SIZE} --fplist gpt_partition.list --outfile SD_Data.fai --area_name "SD Data" --gptfile SD_Data.gpt --sector_size 4096 mv SD_Data* ${root_path} ;; *) # mmc - ./mktcimg --parttype gpt --storage_size 31268536320 --fplist gpt_partition.list --outfile SD_Data.fai --area_name "SD Data" --gptfile SD_Data.gpt + ./mktcimg --parttype gpt --storage_size ${MMC_SIZE} --fplist gpt_partition.list --outfile SD_Data.fai --area_name "SD Data" --gptfile SD_Data.gpt mv SD_Data* ${root_path} ;; esac @@ -151,8 +168,8 @@ make_sd() { } echo "=== Select Chip model ===" -for ((i=0; i<${CHIP[@]}+1; i++)); do - echo "[${i+1}] ${CHIP[$i]}" +for ((i=0; i<${#CHIP[@]}; i++)); do + echo "[$((i+1))] ${CHIP[$i]}" done read -r -p "CHIP: " opt