From 31d32668f5ff629de336d01fd6613a11cff2f662 Mon Sep 17 00:00:00 2001 From: Pontus Hedman Date: Tue, 3 Dec 2024 14:02:32 -0500 Subject: [PATCH 1/7] New PSL build changes. For use with phedman-test branch of nexus-build --- .gitignore | 3 ++ PSL-README.md | 8 ++++++ PSL-mklinks | 34 +++++++++++++++++++++++ patches/scripts/build_distroiGOS.sh.patch | 25 +++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 PSL-README.md create mode 100755 PSL-mklinks create mode 100644 patches/scripts/build_distroiGOS.sh.patch diff --git a/.gitignore b/.gitignore index 07ece42..e95913f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ build tools *.swp logs +buildiGOSti2.sh +scripts/build_distroiGOS.sh +scripts/build_distroiGOS.sh.orig diff --git a/PSL-README.md b/PSL-README.md new file mode 100644 index 0000000..e69870e --- /dev/null +++ b/PSL-README.md @@ -0,0 +1,8 @@ +# Perle ti-bdebstrap fork + +This is a fork from +https://github.com/TexasInstruments/ti-bdebstrap.git + +To merge TI's upstream changes, do: + + git merge --ff origin/master diff --git a/PSL-mklinks b/PSL-mklinks new file mode 100755 index 0000000..5e2a1cf --- /dev/null +++ b/PSL-mklinks @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Make symbolic links into nexus-build +# +test $# != 1 && { echo "Usage: $0 dstdir" >&2; exit 1; } +DST=$1 +test -d $DST || { echo "$0: $DST does not exist" >&2; exit 2; } + +set -e +cd $(dirname $0) + +F=buildiGOSti2.sh +if [ ! -f "$F" ]; then + echo "I: Modifying build.sh into $F" + cp -fp build.sh $F + sed -e 's/build_distro.sh/build_distroiGOS.sh/' -e 's/generate_rootfs/#&/' < build.sh > $F +fi + +mkdir -p $DST/scripts +F=scripts/build_distroiGOS.sh +if [ ! -f "$F" ]; then + echo "I: Patching build_distro.sh into $F" + cp -fp scripts/build_distro.sh $F + patch -p0 -F20 < patches/$F.patch +fi +ln -rfvs $F $DST/scripts + +rm -rf $DST/configs +ln -rfvs configs $DST +ln -rfvs builds.toml $DST +ln -rfvs create-sdcard.sh $DST +ln -rfvs scripts/build_bsp.sh $DST/scripts +ln -rfvs scripts/common.sh $DST/scripts +ln -rfvs scripts/setup.sh $DST/scripts diff --git a/patches/scripts/build_distroiGOS.sh.patch b/patches/scripts/build_distroiGOS.sh.patch new file mode 100644 index 0000000..8bb380a --- /dev/null +++ b/patches/scripts/build_distroiGOS.sh.patch @@ -0,0 +1,25 @@ +--- scripts/build_distroiGOS.sh 2024-10-00 00:00:00.000000000 -0500 ++++ scripts/build_distroiGOS.sh 2024-11-00 00:00:00.000000000 -0500 +@@ -21,7 +21,7 @@ + + cd ${topdir}/build/ + +- ROOTFS_DIR=${topdir}/build/${distro}/tisdk-debian-${distro}}-rootfs ++ ROOTFS_DIR=${topdir}/build/${distro}/tisdk-debian-${distro}-rootfs + } + + function package_and_clean() { +@@ -29,6 +29,8 @@ + bsp_version=$2 + + cd ${topdir}/build/${build} ++ rm -rf tisdk-debian-${distro}-${bsp_version}-rootfs ++ cp -rp ../fs/ tisdk-debian-${distro}-${bsp_version}-rootfs + + log "> Cleaning up ${build}" + tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-rootfs.tar.xz tisdk-debian-${distro}-${bsp_version}-rootfs &>>"${LOG_FILE}" +@@ -44,4 +46,3 @@ + log "> Packaging ${build}" + tar --use-compress-program="pigz --best --recursive | pv" -cf ${distro}-${bsp_version}.tar.xz ${build} &>>"${LOG_FILE}" + } +- From 308cc67ccb9a7424a6e8c25f60d205b5cf52f0a1 Mon Sep 17 00:00:00 2001 From: Pontus Hedman Date: Wed, 4 Dec 2024 10:40:22 -0500 Subject: [PATCH 2/7] create-sdcardiGOS.sh support --- .gitignore | 1 + PSL-mklinks | 9 ++++++++- patches/create-sdcardiGOS.sh.patch | 30 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 patches/create-sdcardiGOS.sh.patch diff --git a/.gitignore b/.gitignore index e95913f..a560935 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ tools *.swp logs buildiGOSti2.sh +create-sdcardiGOS.sh scripts/build_distroiGOS.sh scripts/build_distroiGOS.sh.orig diff --git a/PSL-mklinks b/PSL-mklinks index 5e2a1cf..c9b3661 100755 --- a/PSL-mklinks +++ b/PSL-mklinks @@ -25,10 +25,17 @@ if [ ! -f "$F" ]; then fi ln -rfvs $F $DST/scripts +F=create-sdcardiGOS.sh +if [ ! -f "$F" ]; then + echo "I: Patching create-sdcard.sh into $F" + cp -fp create-sdcard.sh $F + patch -p1 -F20 < patches/$F.patch +fi +ln -rfvs $F $DST + rm -rf $DST/configs ln -rfvs configs $DST ln -rfvs builds.toml $DST -ln -rfvs create-sdcard.sh $DST ln -rfvs scripts/build_bsp.sh $DST/scripts ln -rfvs scripts/common.sh $DST/scripts ln -rfvs scripts/setup.sh $DST/scripts diff --git a/patches/create-sdcardiGOS.sh.patch b/patches/create-sdcardiGOS.sh.patch new file mode 100644 index 0000000..25741a4 --- /dev/null +++ b/patches/create-sdcardiGOS.sh.patch @@ -0,0 +1,30 @@ +diff --git a/create-sdcardiGOS.sh b/create-sdcardiGOS.sh +index a1b1190..1beda4e 100755 +--- a/create-sdcardiGOS.sh ++++ b/create-sdcardiGOS.sh +@@ -182,7 +182,7 @@ populate_3_partitions() { + mkdir $PWD/tmp + + mount -t vfat ${DRIVE}${P}1 boot +- mount -t ext3 ${DRIVE}${P}2 rootfs ++ mount ${DRIVE}${P}2 rootfs + mount -t ext3 ${DRIVE}${P}3 start_here + + # Remove any existing content in case the partitions were not +@@ -673,7 +673,7 @@ mkdir $PATH_TO_SDBOOT + mkdir $PATH_TO_SDROOTFS + + sudo mount -t vfat ${DRIVE}${P}1 boot/ +-sudo mount -t ext3 ${DRIVE}${P}2 rootfs/ ++sudo mount ${DRIVE}${P}2 rootfs/ + + + +@@ -690,6 +690,7 @@ sync + sync + sync + ++build=* + BOOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-boot.tar.xz" + ROOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-rootfs.tar.xz" + From 351c0c1cbc1189fb659295251674e51799dd8be4 Mon Sep 17 00:00:00 2001 From: Dennis Kong Date: Fri, 24 Jan 2025 18:17:13 -0500 Subject: [PATCH 3/7] N-12006:fix special file capabilities missing by not using tar file and copying with rsync and cp -ra options --- patches/create-sdcardiGOS.sh.patch | 19 ++++++++++++++----- patches/scripts/build_distroiGOS.sh.patch | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/patches/create-sdcardiGOS.sh.patch b/patches/create-sdcardiGOS.sh.patch index 25741a4..cf3bcc8 100644 --- a/patches/create-sdcardiGOS.sh.patch +++ b/patches/create-sdcardiGOS.sh.patch @@ -1,7 +1,7 @@ -diff --git a/create-sdcardiGOS.sh b/create-sdcardiGOS.sh -index a1b1190..1beda4e 100755 ---- a/create-sdcardiGOS.sh -+++ b/create-sdcardiGOS.sh +diff --git a/create-sdcard.sh b/create-sdcard.sh +index a1b1190..4f4e953 100755 +--- a/create-sdcard.sh ++++ b/create-sdcard.sh @@ -182,7 +182,7 @@ populate_3_partitions() { mkdir $PWD/tmp @@ -20,11 +20,20 @@ index a1b1190..1beda4e 100755 -@@ -690,6 +690,7 @@ sync +@@ -690,8 +690,10 @@ sync sync sync +build=* BOOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-boot.tar.xz" ROOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-rootfs.tar.xz" ++ROOTFSPATH="$PARSEPATH/tisdk-debian-${build}-rootfs/*" + cat << EOM + ################################################################################ +@@ -710,7 +712,7 @@ echo "" + sync + + echo "Copying rootfs System partition" +-untar_progress $ROOTFILEPATH $PATH_TO_SDROOTFS ++rsync -aHAX $ROOTFSPATH $PATH_TO_SDROOTFS diff --git a/patches/scripts/build_distroiGOS.sh.patch b/patches/scripts/build_distroiGOS.sh.patch index 8bb380a..2fb1589 100644 --- a/patches/scripts/build_distroiGOS.sh.patch +++ b/patches/scripts/build_distroiGOS.sh.patch @@ -14,7 +14,7 @@ cd ${topdir}/build/${build} + rm -rf tisdk-debian-${distro}-${bsp_version}-rootfs -+ cp -rp ../fs/ tisdk-debian-${distro}-${bsp_version}-rootfs ++ cp -ra ../fs/ tisdk-debian-${distro}-${bsp_version}-rootfs log "> Cleaning up ${build}" tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-rootfs.tar.xz tisdk-debian-${distro}-${bsp_version}-rootfs &>>"${LOG_FILE}" From 892cbb19516f825de4c31cc5a5a23bbe7c3871c6 Mon Sep 17 00:00:00 2001 From: Dennis Kong Date: Mon, 27 Jan 2025 18:31:10 -0500 Subject: [PATCH 4/7] N-12006-fix invalid patch for create-sdcardiGOS.sh and removed -F20 option from PSL-mklinks script --- PSL-mklinks | 2 +- patches/create-sdcardiGOS.sh.patch | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PSL-mklinks b/PSL-mklinks index c9b3661..71bbe9c 100755 --- a/PSL-mklinks +++ b/PSL-mklinks @@ -29,7 +29,7 @@ F=create-sdcardiGOS.sh if [ ! -f "$F" ]; then echo "I: Patching create-sdcard.sh into $F" cp -fp create-sdcard.sh $F - patch -p1 -F20 < patches/$F.patch + patch -p1 < patches/$F.patch fi ln -rfvs $F $DST diff --git a/patches/create-sdcardiGOS.sh.patch b/patches/create-sdcardiGOS.sh.patch index cf3bcc8..685dde1 100644 --- a/patches/create-sdcardiGOS.sh.patch +++ b/patches/create-sdcardiGOS.sh.patch @@ -1,7 +1,7 @@ -diff --git a/create-sdcard.sh b/create-sdcard.sh +diff --git a/create-sdcardiGOS.sh b/create-sdcardiGOS.sh index a1b1190..4f4e953 100755 ---- a/create-sdcard.sh -+++ b/create-sdcard.sh +--- a/create-sdcardiGOS.sh ++++ b/create-sdcardiGOS.sh @@ -182,7 +182,7 @@ populate_3_partitions() { mkdir $PWD/tmp From 0626f13b35515e7d9128d19a91107bc01fbf498f Mon Sep 17 00:00:00 2001 From: Jack Kim Date: Fri, 14 Feb 2025 10:52:11 -0500 Subject: [PATCH 5/7] Fix to meet new strategy As we decide to manage our repo and directly apply changes to our code, 1. Removed patch/copy things in "PSL-mklinks" script. 2. Applied changes to the source tree directoy. --- .gitignore | 4 - PSL-mklinks | 31 +- buildiGOSti2.sh | 76 +++ create-sdcardiGOS.sh | 741 ++++++++++++++++++++++ patches/create-sdcardiGOS.sh.patch | 39 -- patches/scripts/build_distroiGOS.sh.patch | 25 - scripts/build_distroiGOS.sh | 48 ++ 7 files changed, 869 insertions(+), 95 deletions(-) create mode 100755 buildiGOSti2.sh create mode 100755 create-sdcardiGOS.sh delete mode 100644 patches/create-sdcardiGOS.sh.patch delete mode 100644 patches/scripts/build_distroiGOS.sh.patch create mode 100755 scripts/build_distroiGOS.sh diff --git a/.gitignore b/.gitignore index a560935..07ece42 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,3 @@ build tools *.swp logs -buildiGOSti2.sh -create-sdcardiGOS.sh -scripts/build_distroiGOS.sh -scripts/build_distroiGOS.sh.orig diff --git a/PSL-mklinks b/PSL-mklinks index 71bbe9c..dfac719 100755 --- a/PSL-mklinks +++ b/PSL-mklinks @@ -9,33 +9,10 @@ test -d $DST || { echo "$0: $DST does not exist" >&2; exit 2; } set -e cd $(dirname $0) -F=buildiGOSti2.sh -if [ ! -f "$F" ]; then - echo "I: Modifying build.sh into $F" - cp -fp build.sh $F - sed -e 's/build_distro.sh/build_distroiGOS.sh/' -e 's/generate_rootfs/#&/' < build.sh > $F -fi - -mkdir -p $DST/scripts -F=scripts/build_distroiGOS.sh -if [ ! -f "$F" ]; then - echo "I: Patching build_distro.sh into $F" - cp -fp scripts/build_distro.sh $F - patch -p0 -F20 < patches/$F.patch -fi -ln -rfvs $F $DST/scripts - -F=create-sdcardiGOS.sh -if [ ! -f "$F" ]; then - echo "I: Patching create-sdcard.sh into $F" - cp -fp create-sdcard.sh $F - patch -p1 < patches/$F.patch -fi -ln -rfvs $F $DST - rm -rf $DST/configs ln -rfvs configs $DST ln -rfvs builds.toml $DST -ln -rfvs scripts/build_bsp.sh $DST/scripts -ln -rfvs scripts/common.sh $DST/scripts -ln -rfvs scripts/setup.sh $DST/scripts +ln -rfvs create-sdcardiGOS.sh $DST + +rm -rf $DST/scripts +ln -rfvs scripts $DST diff --git a/buildiGOSti2.sh b/buildiGOSti2.sh new file mode 100755 index 0000000..be0f226 --- /dev/null +++ b/buildiGOSti2.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# Filename: build.sh +# Author: "Sai Sree Kartheek Adivi " +# Description: Script to build a Debian SD card image for TI Platforms +############################################################################### + +# set -x + +export topdir=$(git rev-parse --show-toplevel) + +source ${topdir}/scripts/setup.sh +source ${topdir}/scripts/common.sh +source ${topdir}/scripts/build_bsp.sh +source ${topdir}/scripts/build_distroiGOS.sh + +if [ "$EUID" -ne 0 ] ; then + echo "Failed to run: requires root privileges" + echo "Exiting" + exit 1 +fi + +# exit if no arguments are passed +if [ "$#" -ne 0 ]; then + builds="$@" +else + echo "build.sh: missing operand" + echo "Specify one or more builds from the \"builds.toml\" file." + exit 1 +fi + +mkdir -p ${topdir}/build + +for build in ${builds} +do + + echo "${build}" + + validate_section "Build" ${build} "${topdir}/builds.toml" + + machine=($(read_build_config ${build} machine)) + distro_codename=($(read_build_config ${build} distro_codename)) + rt_linux=($(read_build_config ${build} rt_linux)) + + if [ ${rt_linux} == "true" ]; then + distro=${distro_codename}-rt-${machine} + else + distro=${distro_codename}-${machine} + fi + + bsp_version=($(read_bsp_config ${distro_codename} bsp_version)) + + export host_arch=`uname -m` + export native_build=false + export cross_compile=aarch64-none-linux-gnu- + if [ "$host_arch" == "aarch64" ]; then + native_build=true + cross_compile= + fi + + echo "machine: ${machine}" + echo "bsp_version: ${bsp_version}" + echo "distro: ${distro}" + echo "host_arch: ${host_arch}" + + setup_build_tools + + setup_log_file "${build}" + + validate_build ${machine} ${bsp_version} ${distro_codename}/${distro}.yaml + + #generate_rootfs ${distro} ${distro_codename} ${machine} ${bsp_version} + build_bsp ${distro} ${machine} ${bsp_version} + package_and_clean ${distro} ${bsp_version} + +done + diff --git a/create-sdcardiGOS.sh b/create-sdcardiGOS.sh new file mode 100755 index 0000000..4f4e953 --- /dev/null +++ b/create-sdcardiGOS.sh @@ -0,0 +1,741 @@ +#!/bin/bash +# Authors: +# LT Thomas +# Chase Maupin +# Franklin Cooper Jr. +# +# create-sdcard.sh v0.3 + +# This distribution contains contributions or derivatives under copyright +# as follows: +# +# Copyright (c) 2023, Texas Instruments Incorporated +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# - Neither the name of Texas Instruments nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Force locale language to be set to English. This avoids issues when doing +# text and string processing. +export LANG=C + +# Determine the absolute path to the executable +# EXE will have the PWD removed so we can concatenate with the PWD safely +PWD=`pwd` +EXE=`echo $0 | sed s=$PWD==` +EXEPATH="$PWD"/"$EXE" +clear + +build=${1} +PARSEPATH=./build/${build} + +cat << EOM + +################################################################################ + +This script will create a bootable SD card from the built binaries. + +The script must be run with root permissions and from the bin directory of +the SDK + +Usage: + $ sudo ./create-sdcard.sh + +Formatting can be skipped if the SD card is already formatted and +partitioned properly. + +################################################################################ + +EOM + +AMIROOT=`whoami | awk {'print $1'}` +if [ "$AMIROOT" != "root" ] ; then + + echo " **** Error *** must run script with sudo" + echo "" + exit +fi + +#Precentage function +untar_progress () +{ + TARBALL=$1; + DIRECTPATH=$2; + REALPATH=`realpath $TARBALL` + echo "Copying $REALPATH" + cd $DIRECTPATH + tar -xf $REALPATH + sudo mv tisdk*/* . + sudo rm -rf tisdk* + cd - > /dev/null +} + +#copy/paste programs +cp_progress () +{ + CURRENTSIZE=0 + while [ $CURRENTSIZE -lt $TOTALSIZE ] + do + TOTALSIZE=$1; + TOHERE=$2; + CURRENTSIZE=`sudo du -c $TOHERE | grep total | awk {'print $1'}` + echo -e -n "$CURRENTSIZE / $TOTALSIZE copied \r" + sleep 1 + done +} + +check_for_sdcards() +{ + # find the avaible SD cards + ROOTDRIVE=`mount | grep 'on / ' | awk {'print $1'} | cut -c6-8` + PARTITION_TEST=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n ''` + if [ "$PARTITION_TEST" = "" ]; then + echo -e "Please insert a SD card to continue\n" + while [ "$PARTITION_TEST" = "" ]; do + read -p "Type 'y' to re-detect the SD card or 'n' to exit the script: " REPLY + if [ "$REPLY" = 'n' ]; then + exit 1 + fi + ROOTDRIVE=`mount | grep 'on / ' | awk {'print $1'} | cut -c6-8` + PARTITION_TEST=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n ''` + done + fi +} + +populate_3_partitions() { + ENTERCORRECTLY="0" + while [ $ENTERCORRECTLY -ne 1 ] + do + read -e -p 'Enter path where SD card tarballs were downloaded : ' TARBALLPATH + + echo "" + ENTERCORRECTLY=1 + if [ -d $TARBALLPATH ] + then + echo "Directory exists" + echo "" + echo "This directory contains:" + ls $TARBALLPATH + echo "" + read -p 'Is this correct? [y/n] : ' ISRIGHTPATH + case $ISRIGHTPATH in + "y" | "Y") ;; + "n" | "N" ) ENTERCORRECTLY=0;continue;; + *) echo "Please enter y or n";ENTERCORRECTLY=0;continue;; + esac + else + echo "Invalid path make sure to include complete path" + ENTERCORRECTLY=0 + continue + fi + # Check that tarballs were found + if [ ! -e "$TARBALLPATH""/boot_partition.tar.xz" ] + then + echo "Could not find boot_partition.tar.xz as expected. Please" + echo "point to the directory containing the boot_partition.tar.xz" + ENTERCORRECTLY=0 + continue + fi + + if [ ! -e "$TARBALLPATH""/rootfs_partition.tar.xz" ] + then + echo "Could not find rootfs_partition.tar.xz as expected. Please" + echo "point to the directory containing the rootfs_partition.tar.xz" + ENTERCORRECTLY=0 + continue + fi + + if [ ! -e "$TARBALLPATH""/start_here_partition.tar.xz" ] + then + echo "Could not find start_here_partition.tar.xz as expected. Please" + echo "point to the directory containing the start_here_partition.tar.xz" + ENTERCORRECTLY=0 + continue + fi + done + + # Make temporary directories and untar mount the partitions + mkdir $PWD/boot + mkdir $PWD/rootfs + mkdir $PWD/start_here + mkdir $PWD/tmp + + mount -t vfat ${DRIVE}${P}1 boot + mount ${DRIVE}${P}2 rootfs + mount -t ext3 ${DRIVE}${P}3 start_here + + # Remove any existing content in case the partitions were not + # recreated + sudo rm -rf boot/* + sudo rm -rf rootfs/* + sudo rm -rf start_here/* + + # Extract the tarball contents. +cat << EOM + +################################################################################ + Extracting boot partition tarball + +################################################################################ +EOM + untar_progress $TARBALLPATH/boot_partition.tar.xz tmp/ + if [ -e "./tmp/MLO" ] + then + cp ./tmp/MLO boot/ + fi + cp -rf ./tmp/* boot/ + +cat << EOM + +################################################################################ + Extracting rootfs partition tarball + +################################################################################ +EOM + untar_progress $TARBALLPATH/rootfs_partition.tar.xz rootfs/ + +cat << EOM + +################################################################################ + Extracting start_here partition to temp directory + +################################################################################ +EOM + rm -rf tmp/* + untar_progress $TARBALLPATH/start_here_partition.tar.xz tmp/ + +cat << EOM + +################################################################################ + Copying Contents to START_HERE + +################################################################################ +EOM + + TOTALSIZE=`sudo du -c tmp/* | grep total | awk {'print $1'}` + cp -rf tmp/* start_here/ & + cp_progress $TOTALSIZE start_here/ + sync;sync + # Fix up the START_HERE partitoin permissions + chown nobody -R start_here + chgrp nogroup -R start_here + + umount boot rootfs start_here + sync;sync + + # Clean up the temp directories + rm -rf boot rootfs start_here tmp +} + + +# find the avaible SD cards +ROOTDRIVE=`mount | grep 'on / ' | awk {'print $1'} | cut -c6-9` +if [ "$ROOTDRIVE" = "root" ]; then + ROOTDRIVE=`readlink /dev/root | cut -c1-3` +else + ROOTDRIVE=`echo $ROOTDRIVE | cut -c1-3` +fi + +PARTITION_TEST=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n ''` + +# Check for available mounts +check_for_sdcards + +echo -e "\nAvailable Drives to write images to: \n" +echo "# major minor size name " +cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n '' +echo " " + +DEVICEDRIVENUMBER= +while true; +do + read -p 'Enter Device Number or 'n' to exit: ' DEVICEDRIVENUMBER + echo " " + if [ "$DEVICEDRIVENUMBER" = 'n' ]; then + exit 1 + fi + + if [ "$DEVICEDRIVENUMBER" = "" ]; then + # Check to see if there are any changes + check_for_sdcards + echo -e "These are the Drives available to write images to:" + echo "# major minor size name " + cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n '' + echo " " + continue + fi + + DEVICEDRIVENAME=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n '' | grep "${DEVICEDRIVENUMBER}:" | awk '{print $5}'` + if [ -n "$DEVICEDRIVENAME" ] + then + DRIVE=/dev/$DEVICEDRIVENAME + DEVICESIZE=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n '' | grep "${DEVICEDRIVENUMBER}:" | awk '{print $4}'` + break + else + echo -e "Invalid selection!" + # Check to see if there are any changes + check_for_sdcards + echo -e "These are the only Drives available to write images to: \n" + echo "# major minor size name " + cat /proc/partitions | grep -v $ROOTDRIVE | grep '\\|\' | grep -n '' + echo " " + fi +done + +echo "$DEVICEDRIVENAME was selected" +#Check the size of disk to make sure its under 16GB +if [ $DEVICESIZE -gt 17000000 ] ; then +cat << EOM + +################################################################################ + + **********WARNING********** + + Selected Device is greater then 16GB + Continuing past this point will erase data from device + Double check that this is the correct SD Card + +################################################################################ + +EOM + ENTERCORRECTLY=0 + while [ $ENTERCORRECTLY -ne 1 ] + do + read -p 'Would you like to continue [y/n] : ' SIZECHECK + echo "" + echo " " + ENTERCORRECTLY=1 + case $SIZECHECK in + "y") ;; + "n") exit;; + *) echo "Please enter y or n";ENTERCORRECTLY=0;; + esac + echo "" + done + +fi +echo "" + +DRIVE=/dev/$DEVICEDRIVENAME +NUM_OF_DRIVES=`df | grep -c $DEVICEDRIVENAME` + +# This if statement will determine if we have a mounted sdX or mmcblkX device. +# If it is mmcblkX, then we need to set an extra char in the partition names, 'p', +# to account for /dev/mmcblkXpY labled partitions. +if [[ ${DEVICEDRIVENAME} =~ ^sd. ]]; then + echo "$DRIVE is an sdx device" + P='' +else + echo "$DRIVE is an mmcblkx device" + P='p' +fi + +if [ "$NUM_OF_DRIVES" != "0" ]; then + echo "Unmounting the $DEVICEDRIVENAME drives" + for ((c=1; c<="$NUM_OF_DRIVES"; c++ )) + do + unmounted=`df | grep '\<'$DEVICEDRIVENAME$P$c'\>' | awk '{print $1}'` + if [ -n "$unmounted" ] + then + echo " unmounted ${DRIVE}$P$c" + sudo umount -f ${DRIVE}$P$c + fi + + done +fi + +# Refresh this variable as the device may not be mounted at script instantiation time +# This will always return one more then needed +NUM_OF_PARTS=`cat /proc/partitions | grep -v $ROOTDRIVE | grep -c $DEVICEDRIVENAME` +for ((c=1; c<"$NUM_OF_PARTS"; c++ )) +do + SIZE=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\<'$DEVICEDRIVENAME$P$c'\>' | awk '{print $3}'` + echo "Current size of $DEVICEDRIVENAME$P$c $SIZE bytes" +done + +# check to see if the device is already partitioned +for (( c=1; c<5; c++ )) +do + eval "SIZE$c=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\<'$DEVICEDRIVENAME$P$c'\>' | awk '{print $3}'`" +done + +PARTITION="0" +if [ -n "$SIZE1" -a -n "$SIZE2" ] ; then + if [ "$SIZE1" -gt "128000" -a "$SIZE2" -gt "700000" ] + then + PARTITION=1 + + if [ -z "$SIZE3" -a -z "$SIZE4" ] + then + #Detected 2 partitions + PARTS=2 + + elif [ "$SIZE3" -gt "1000" -a -z "$SIZE4" ] + then + #Detected 3 partitions + PARTS=3 + + else + echo "SD Card is not correctly partitioned" + PARTITION=0 + fi + fi +else + echo "SD Card is not correctly partitioned" + PARTITION=0 + PARTS=0 +fi + + +#Partition is found +if [ "$PARTITION" -eq "1" ] +then +cat << EOM + +################################################################################ + + Detected device has $PARTS partitions already + + Re-partitioning will allow the choice of 2 or 3 partitions + +################################################################################ + +EOM + + ENTERCORRECTLY=0 + while [ $ENTERCORRECTLY -ne 1 ] + do + read -p 'Would you like to re-partition the drive anyways [y/n] : ' CASEPARTITION + echo "" + echo " " + ENTERCORRECTLY=1 + case $CASEPARTITION in + "y") echo "Now partitioning $DEVICEDRIVENAME ...";PARTITION=0;; + "n") echo "Skipping partitioning";; + *) echo "Please enter y or n";ENTERCORRECTLY=0;; + esac + echo "" + done + +fi + +#Partition is not found, choose to partition 2 or 3 segments +if [ "$PARTITION" -eq "0" ] +then +cat << EOM + +################################################################################ + + Select 2 partitions if only need boot and rootfs (most users). + Select 3 partitions if need SDK & other content on SD card. This is + usually used by device manufacturers with access to partition tarballs. + + ****WARNING**** continuing will erase all data on $DEVICEDRIVENAME + +################################################################################ + +EOM + ENTERCORRECTLY=0 + while [ $ENTERCORRECTLY -ne 1 ] + do + + read -p 'Number of partitions needed [2/3] : ' CASEPARTITIONNUMBER + echo "" + echo " " + ENTERCORRECTLY=1 + case $CASEPARTITIONNUMBER in + "2") echo "Now partitioning $DEVICEDRIVENAME with 2 partitions...";PARTITION=2;; + "3") echo "Now partitioning $DEVICEDRIVENAME with 3 partitions...";PARTITION=3;; + "n") exit;; + *) echo "Please enter 2 or 3";ENTERCORRECTLY=0;; + esac + echo " " + done +fi + + + +#Section for partitioning the drive + +#create 3 partitions +if [ "$PARTITION" -eq "3" ] +then + +# set the PARTS value as well +PARTS=3 + +cat << EOM + +################################################################################ + + Now making 3 partitions + +################################################################################ + +EOM + +dd if=/dev/zero of=$DRIVE bs=1024 count=1024 + +SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'` + +echo DISK SIZE - $SIZE bytes + +cat << END | fdisk $DRIVE +n +p +1 + ++128M +n +p +2 + ++2.4G +n +p +3 + + +t +1 +c +a +1 +w +END + + +cat << EOM + +################################################################################ + + Partitioning Boot + +################################################################################ +EOM + mkfs.vfat -F 32 -n "boot" ${DRIVE}${P}1 +cat << EOM + +################################################################################ + + Partitioning Rootfs + +################################################################################ +EOM + mkfs.ext3 -L "rootfs" ${DRIVE}${P}2 +cat << EOM + +################################################################################ + + Partitioning START_HERE + +################################################################################ +EOM + mkfs.ext3 -L "START_HERE" ${DRIVE}${P}3 + sync + sync + +#create only 2 partitions +elif [ "$PARTITION" -eq "2" ] +then + +# Set the PARTS value as well +PARTS=2 +cat << EOM + +################################################################################ + + Now making 2 partitions + +################################################################################ + +EOM +dd if=/dev/zero of=$DRIVE bs=1024 count=1024 + +SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'` + +echo DISK SIZE - $SIZE bytes + +cat << END | fdisk $DRIVE +n +p +1 + ++128M +n +p +2 + + +t +1 +c +a +1 +w +END + +cat << EOM + +################################################################################ + + Partitioning Boot + +################################################################################ +EOM + mkfs.vfat -F 32 -n "boot" ${DRIVE}${P}1 +cat << EOM + +################################################################################ + + Partitioning rootfs + +################################################################################ +EOM + mkfs.ext3 -L "rootfs" ${DRIVE}${P}2 + sync + sync + INSTALLSTARTHERE=n +fi + + + +#Break between partitioning and installing file system +cat << EOM + + +################################################################################ + + Partitioning is now done + Continue to install filesystem or select 'n' to safe exit + + **Warning** Continuing will erase files any files in the partitions + +################################################################################ + + +EOM +ENTERCORRECTLY=0 +while [ $ENTERCORRECTLY -ne 1 ] +do + read -p 'Would you like to continue? [y/n] : ' EXITQ + echo "" + echo " " + ENTERCORRECTLY=1 + case $EXITQ in + "y") ;; + "n") exit;; + *) echo "Please enter y or n";ENTERCORRECTLY=0;; + esac +done + +# If this is a three partition card then we will jump to a function to +# populate the three partitions and then exit the script. If not we +# go on to prompt the user for input on the two partitions +if [ "$PARTS" -eq "3" ] +then + populate_3_partitions + exit 0 +fi + +#Add directories for images +export START_DIR=$PWD +mkdir $START_DIR/tmp +export PATH_TO_SDBOOT=boot +export PATH_TO_SDROOTFS=rootfs +export PATH_TO_TMP_DIR=$START_DIR/tmp + + +echo " " +echo "Mount the partitions " +mkdir $PATH_TO_SDBOOT +mkdir $PATH_TO_SDROOTFS + +sudo mount -t vfat ${DRIVE}${P}1 boot/ +sudo mount ${DRIVE}${P}2 rootfs/ + + + +echo " " +echo "Emptying partitions " +echo " " +sudo rm -rf $PATH_TO_SDBOOT/* +sudo rm -rf $PATH_TO_SDROOTFS/* + +echo "" +echo "Syncing...." +echo "" +sync +sync +sync + +build=* +BOOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-boot.tar.xz" +ROOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-rootfs.tar.xz" +ROOTFSPATH="$PARSEPATH/tisdk-debian-${build}-rootfs/*" + +cat << EOM +################################################################################ + + Copying files now... will take minutes + +################################################################################ + +Copying boot partition +EOM + + +untar_progress $BOOTFILEPATH $PATH_TO_SDBOOT +echo "" + +sync + +echo "Copying rootfs System partition" +rsync -aHAX $ROOTFSPATH $PATH_TO_SDROOTFS + +echo "" +echo "" +sync +sync +sync +sync +sync +sync + +echo " " +echo "Un-mount the partitions " +sudo umount -f $PATH_TO_SDBOOT +sudo umount -f $PATH_TO_SDROOTFS + + +echo " " +echo "Remove created temp directories " +sudo rm -rf $PATH_TO_TMP_DIR +sudo rm -rf $PATH_TO_SDROOTFS +sudo rm -rf $PATH_TO_SDBOOT + + +echo " " +echo "Operation Finished" +echo " " diff --git a/patches/create-sdcardiGOS.sh.patch b/patches/create-sdcardiGOS.sh.patch deleted file mode 100644 index 685dde1..0000000 --- a/patches/create-sdcardiGOS.sh.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/create-sdcardiGOS.sh b/create-sdcardiGOS.sh -index a1b1190..4f4e953 100755 ---- a/create-sdcardiGOS.sh -+++ b/create-sdcardiGOS.sh -@@ -182,7 +182,7 @@ populate_3_partitions() { - mkdir $PWD/tmp - - mount -t vfat ${DRIVE}${P}1 boot -- mount -t ext3 ${DRIVE}${P}2 rootfs -+ mount ${DRIVE}${P}2 rootfs - mount -t ext3 ${DRIVE}${P}3 start_here - - # Remove any existing content in case the partitions were not -@@ -673,7 +673,7 @@ mkdir $PATH_TO_SDBOOT - mkdir $PATH_TO_SDROOTFS - - sudo mount -t vfat ${DRIVE}${P}1 boot/ --sudo mount -t ext3 ${DRIVE}${P}2 rootfs/ -+sudo mount ${DRIVE}${P}2 rootfs/ - - - -@@ -690,8 +690,10 @@ sync - sync - sync - -+build=* - BOOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-boot.tar.xz" - ROOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-rootfs.tar.xz" -+ROOTFSPATH="$PARSEPATH/tisdk-debian-${build}-rootfs/*" - - cat << EOM - ################################################################################ -@@ -710,7 +712,7 @@ echo "" - sync - - echo "Copying rootfs System partition" --untar_progress $ROOTFILEPATH $PATH_TO_SDROOTFS -+rsync -aHAX $ROOTFSPATH $PATH_TO_SDROOTFS diff --git a/patches/scripts/build_distroiGOS.sh.patch b/patches/scripts/build_distroiGOS.sh.patch deleted file mode 100644 index 2fb1589..0000000 --- a/patches/scripts/build_distroiGOS.sh.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- scripts/build_distroiGOS.sh 2024-10-00 00:00:00.000000000 -0500 -+++ scripts/build_distroiGOS.sh 2024-11-00 00:00:00.000000000 -0500 -@@ -21,7 +21,7 @@ - - cd ${topdir}/build/ - -- ROOTFS_DIR=${topdir}/build/${distro}/tisdk-debian-${distro}}-rootfs -+ ROOTFS_DIR=${topdir}/build/${distro}/tisdk-debian-${distro}-rootfs - } - - function package_and_clean() { -@@ -29,6 +29,8 @@ - bsp_version=$2 - - cd ${topdir}/build/${build} -+ rm -rf tisdk-debian-${distro}-${bsp_version}-rootfs -+ cp -ra ../fs/ tisdk-debian-${distro}-${bsp_version}-rootfs - - log "> Cleaning up ${build}" - tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-rootfs.tar.xz tisdk-debian-${distro}-${bsp_version}-rootfs &>>"${LOG_FILE}" -@@ -44,4 +46,3 @@ - log "> Packaging ${build}" - tar --use-compress-program="pigz --best --recursive | pv" -cf ${distro}-${bsp_version}.tar.xz ${build} &>>"${LOG_FILE}" - } -- diff --git a/scripts/build_distroiGOS.sh b/scripts/build_distroiGOS.sh new file mode 100755 index 0000000..e074e79 --- /dev/null +++ b/scripts/build_distroiGOS.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +source ${topdir}/scripts/common.sh + +function generate_rootfs() { +distro=$1 +distro_codename=$2 +machine=$3 +bsp_version=$4 + + cd ${topdir} + + log "> Building rootfs .." + bdebstrap \ + -c ${topdir}/configs/bdebstrap_configs/${distro_codename}/${distro}.yaml \ + --name ${topdir}/build/${distro} \ + --target tisdk-debian-${distro}-${bsp_version}-rootfs \ + --hostname ${machine} \ + -f \ + &>>"${LOG_FILE}" + + cd ${topdir}/build/ + + ROOTFS_DIR=${topdir}/build/${distro}/tisdk-debian-${distro}-rootfs +} + +function package_and_clean() { +build=$1 +bsp_version=$2 + + cd ${topdir}/build/${build} + rm -rf tisdk-debian-${distro}-${bsp_version}-rootfs + cp -ra ../fs/ tisdk-debian-${distro}-${bsp_version}-rootfs + + log "> Cleaning up ${build}" + tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-rootfs.tar.xz tisdk-debian-${distro}-${bsp_version}-rootfs &>>"${LOG_FILE}" + rm -rf tisdk-debian-${distro}-rootfs + + tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-boot.tar.xz tisdk-debian-${distro}-${bsp_version}-boot &>>"${LOG_FILE}" + rm -rf tisdk-debian-${distro}-${bsp_version}-boot + + rm -rf bsp_sources + + cd ${topdir}/build/ + + log "> Packaging ${build}" + tar --use-compress-program="pigz --best --recursive | pv" -cf ${distro}-${bsp_version}.tar.xz ${build} &>>"${LOG_FILE}" +} From 9420bac39bfeb0fb6bc2df7ff43545a0f1afd26e Mon Sep 17 00:00:00 2001 From: Jack Kim Date: Fri, 14 Feb 2025 14:24:25 -0500 Subject: [PATCH 6/7] Add J7200-evm u-boot build. --- buildiGOSti2.sh | 2 +- builds.toml | 5 ++ .../bookworm/bookworm-j7200-evm.yaml | 84 +++++++++++++++++++ configs/bsp_sources.toml | 10 ++- configs/machines/09.02.00.010.toml | 9 ++ configs/machines/09.02.00.011.toml | 55 ++++++++++++ .../0001-tiboot3-default-dtb-fix.patch | 34 ++++++++ scripts/build_bsp.sh | 30 +++++-- scripts/build_distroiGOS.sh | 7 +- 9 files changed, 224 insertions(+), 12 deletions(-) create mode 100644 configs/bdebstrap_configs/bookworm/bookworm-j7200-evm.yaml create mode 100644 configs/machines/09.02.00.011.toml create mode 100644 patches/ti-u-boot/0001-tiboot3-default-dtb-fix.patch diff --git a/buildiGOSti2.sh b/buildiGOSti2.sh index be0f226..7980682 100755 --- a/buildiGOSti2.sh +++ b/buildiGOSti2.sh @@ -47,7 +47,7 @@ do distro=${distro_codename}-${machine} fi - bsp_version=($(read_bsp_config ${distro_codename} bsp_version)) + bsp_version=($(read_bsp_config ${distro} bsp_version)) export host_arch=`uname -m` export native_build=false diff --git a/builds.toml b/builds.toml index 8e0a131..7b4cfde 100644 --- a/builds.toml +++ b/builds.toml @@ -22,6 +22,7 @@ builds = [ "bookworm-rt-am62xxsip-evm", "bookworm-am64xx-evm", "bookworm-rt-am64xx-evm", + "bookworm-j7200-evm", ] # List of all valid trixie builds @@ -126,3 +127,7 @@ builds = [ distro_codename = "bookworm" rt_linux = "true" +[bookworm-j7200-evm] + machine = "j7200-evm" + distro_codename = "bookworm" + rt_linux = "false" diff --git a/configs/bdebstrap_configs/bookworm/bookworm-j7200-evm.yaml b/configs/bdebstrap_configs/bookworm/bookworm-j7200-evm.yaml new file mode 100644 index 0000000..521cb6b --- /dev/null +++ b/configs/bdebstrap_configs/bookworm/bookworm-j7200-evm.yaml @@ -0,0 +1,84 @@ +--- +mmdebstrap: + architectures: + - arm64 + mode: auto + keyrings: + - /usr/share/keyrings/debian-archive-keyring.gpg + suite: bookworm + variant: standard + hostname: j7200-evm + components: + - main + - contrib + - non-free-firmware + packages: + - build-essential + - gpg + - curl + - firmware-ti-connectivity + - init + - iproute2 + - less + - libdrm-dev + - libpam-systemd + - locales + - neofetch + - network-manager + - net-tools + - openssh-server + - sudo + - vim + - k3conf + - weston + - linux-image-6.1.83-k3 + - linux-headers-6.1.83-k3 + - linux-libc-dev + - cryptodev-linux-dkms + - firmware-ti-ipc-j7200 + - firmware-cnm-wave + - firmware-ti-eth-j7200 + - libti-rpmsg-char + - libti-rpmsg-char-dev + - libpru-pssp-dev + - pru-pssp + - parted + - e2fsprogs + mirrors: + - http://deb.debian.org/debian + setup-hooks: + # Setup TI Debian Package Repository + - 'mkdir -p $1/etc/apt/sources.list.d/' + - 'wget https://raw.githubusercontent.com/TexasInstruments/ti-debpkgs/main/ti-debpkgs.sources -P $1/etc/apt/sources.list.d/' + # Setup Apt repository preferences + - 'mkdir -p $1/etc/apt/preferences.d/' + - 'printf "Package: *\nPin: origin TexasInstruments.github.io\nPin-Priority: 1001" >> $1/etc/apt/preferences.d/ti-debpkgs' + # Setup Kernel post-install scripts + - 'mkdir -p $1/etc/kernel/postinst.d/' + - 'echo "PWD = $PWD"' + - 'upload target/kernel/postinst.d/cp-kernel-and-overlays /etc/kernel/postinst.d/cp-kernel-and-overlays' + - 'chmod a+x $1/etc/kernel/postinst.d/cp-kernel-and-overlays' + essential-hooks: + # FIXME: Find a better workaround instead of sleep + - 'sleep 10' # workaround for /proc resource busy unable to umount issue + customize-hooks: + # Remove passwd for root user + - 'chroot "$1" passwd --delete root' + # Fix apt install mandb permission issue + - 'chroot "$1" chown -R man: /var/cache/man/' + - 'chroot "$1" chmod -R 755 /var/cache/man/' + # update packages to avoid mandatory update after first boot + - 'chroot "$1" apt-get update' + # Setup .bashrc for clean command-line experience + - 'chroot "$1" cp /etc/skel/.bashrc ~/.bashrc' + # Enable ssh to root user without password + - 'chroot "$1" echo "PermitRootLogin yes" >> $1/etc/ssh/sshd_config' + - 'chroot "$1" echo "PermitEmptyPasswords yes" >> $1/etc/ssh/sshd_config' + # Resize Rootfs Service + - 'chroot "$1" mkdir -p /usr/bin' + - 'upload target/resize_rootfs/resize_rootfs.sh /usr/bin/resize_rootfs.sh' + - 'chroot "$1" chmod a+x /usr/bin/resize_rootfs.sh' + - 'chroot "$1" mkdir -p /etc/systemd/system/' + - 'upload target/resize_rootfs/resize_rootfs.service /etc/systemd/system/resize_rootfs.service' + - '$BDEBSTRAP_HOOKS/enable-units "$1" resize_rootfs' + diff --git a/configs/bsp_sources.toml b/configs/bsp_sources.toml index 4db1488..05ac8aa 100644 --- a/configs/bsp_sources.toml +++ b/configs/bsp_sources.toml @@ -2,9 +2,12 @@ [trixie] bsp_version = "10.01.08.02" -[bookworm] +[bookworm-am64xx-evm] bsp_version = "09.02.00.010" +[bookworm-j7200-evm] + bsp_version = "09.02.00.011" + # BSP Configurations [10.01.08.02] atf_srcrev = "58b25570c9ef91753b14c2103f45f4be9dddb696" @@ -18,3 +21,8 @@ uboot_srcrev = "09.02.00.010" linux_fw_srcrev = "09.02.00.010" +[09.02.00.011] + atf_srcrev = "58b25570c9ef91753b14c2103f45f4be9dddb696" + optee_srcrev = "4.4.0" + uboot_srcrev = "10.01.08" + linux_fw_srcrev = "ti-linux-firmware" diff --git a/configs/machines/09.02.00.010.toml b/configs/machines/09.02.00.010.toml index d6e44b0..ca107b1 100644 --- a/configs/machines/09.02.00.010.toml +++ b/configs/machines/09.02.00.010.toml @@ -44,3 +44,12 @@ optee_make_args = "." uboot_r5_defconfig = "am64x_evm_r5_defconfig" uboot_a53_defconfig = "am64x_evm_a53_defconfig" + +[j7200-evm] + # u-boot config + atf_target_board = "generic" + atf_make_args="K3_PM_SYSTEM_SUSPEND=1" + optee_platform = "k3-j721e" + optee_make_args = "ta-targets=ta_arm64" + uboot_r5_defconfig = "j7200_evm_r5_defconfig" + uboot_a72_defconfig = "j7200_evm_a72_defconfig" diff --git a/configs/machines/09.02.00.011.toml b/configs/machines/09.02.00.011.toml new file mode 100644 index 0000000..ca107b1 --- /dev/null +++ b/configs/machines/09.02.00.011.toml @@ -0,0 +1,55 @@ +# This file describes various machine specific settings needed for the build + +[am62pxx-evm] + # u-boot config + atf_target_board = "lite" + atf_make_args="K3_PM_SYSTEM_SUSPEND=1" + optee_platform = "k3-am62px" + optee_make_args = "CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1" + uboot_r5_defconfig = "am62px_evm_r5_defconfig" + uboot_a53_defconfig = "am62px_evm_a53_defconfig" + +[am62xx-evm] + # u-boot config + atf_target_board = "lite" + atf_make_args="K3_PM_SYSTEM_SUSPEND=1" + optee_platform = "k3-am62x" + optee_make_args = "CFG_TEE_CORE_LOG_LEVEL=1" + uboot_r5_defconfig = "am62x_evm_r5_defconfig" + uboot_a53_defconfig = "am62x_evm_a53_defconfig" + +[am62xx-lp-evm] + # u-boot config + atf_target_board = "lite" + atf_make_args="K3_PM_SYSTEM_SUSPEND=1" + optee_platform = "k3-am62x" + optee_make_args = "CFG_TEE_CORE_LOG_LEVEL=1" + uboot_r5_defconfig = "am62x_lpsk_r5_defconfig" + uboot_a53_defconfig = "am62x_lpsk_a53_defconfig" + +[am62xxsip-evm] + # u-boot config + atf_target_board = "lite" + atf_make_args="K3_PM_SYSTEM_SUSPEND=1" + optee_platform = "k3-am62x" + optee_make_args = "CFG_TEE_CORE_LOG_LEVEL=1" + uboot_r5_defconfig = "am62x_evm_r5_defconfig,am62xsip_sk_r5.config" + uboot_a53_defconfig = "am62x_evm_a53_defconfig" + +[am64xx-evm] + # u-boot config + atf_target_board = "lite" + atf_make_args="K3_PM_SYSTEM_SUSPEND=1" + optee_platform = "k3-am64x" + optee_make_args = "." + uboot_r5_defconfig = "am64x_evm_r5_defconfig" + uboot_a53_defconfig = "am64x_evm_a53_defconfig" + +[j7200-evm] + # u-boot config + atf_target_board = "generic" + atf_make_args="K3_PM_SYSTEM_SUSPEND=1" + optee_platform = "k3-j721e" + optee_make_args = "ta-targets=ta_arm64" + uboot_r5_defconfig = "j7200_evm_r5_defconfig" + uboot_a72_defconfig = "j7200_evm_a72_defconfig" diff --git a/patches/ti-u-boot/0001-tiboot3-default-dtb-fix.patch b/patches/ti-u-boot/0001-tiboot3-default-dtb-fix.patch new file mode 100644 index 0000000..37f054c --- /dev/null +++ b/patches/ti-u-boot/0001-tiboot3-default-dtb-fix.patch @@ -0,0 +1,34 @@ +diff --git a/arch/arm/dts/k3-j7200-binman.dtsi b/arch/arm/dts/k3-j7200-binman.dtsi +index a524b246187..52d83be9425 100644 +--- a/arch/arm/dts/k3-j7200-binman.dtsi ++++ b/arch/arm/dts/k3-j7200-binman.dtsi +@@ -188,6 +188,7 @@ + &binman { + tiboot3-j7200_sr2-hs-fs-evm.bin { + filename = "tiboot3-j7200_sr2-hs-fs-evm.bin"; ++ symlink = "tiboot3.bin"; + ti-secure-rom { + content = <&u_boot_spl_fs>, <&ti_fs_enc_fs>, <&combined_tifs_cfg_fs>, + <&combined_dm_cfg_fs>, <&sysfw_inner_cert_fs>; +@@ -233,7 +234,7 @@ + &binman { + tiboot3-j7200-gp-evm.bin { + filename = "tiboot3-j7200-gp-evm.bin"; +- symlink = "tiboot3.bin"; ++ /* symlink = "tiboot3.bin"; */ + ti-secure-rom { + content = <&u_boot_spl_unsigned>, <&ti_fs_gp>, + <&combined_tifs_cfg_gp>, <&combined_dm_cfg_gp>; +diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c +index 90d3411e2ff..c6103624b16 100644 +--- a/board/ti/j721e/evm.c ++++ b/board/ti/j721e/evm.c +@@ -401,7 +401,7 @@ void configure_serdes_sierra(void) + static struct ti_fdt_map ti_j721e_evm_fdt_map[] = { + {"j721e", "k3-j721e-common-proc-board.dtb"}, + {"j721e-sk", "k3-j721e-sk.dtb"}, +- {"j7200", "k3-j7200-common-proc-board.dtb"}, ++ {"j7200", "k3-j7200-evm.dtb"}, + { /* Sentinel. */ } + }; + static void setup_board_eeprom_env(void) diff --git a/scripts/build_bsp.sh b/scripts/build_bsp.sh index cd5dbbf..45f8d44 100755 --- a/scripts/build_bsp.sh +++ b/scripts/build_bsp.sh @@ -1,5 +1,18 @@ #!/bin/bash +ROOT_DIR=$(dirname $(dirname $0)) +DEFS_FILE=".defs.mk" + +. ${ROOT_DIR}/${DEFS_FILE} +if [ "$BUILDTYPE" = "bookworm-am64xx-evm" ]; then + ARM_A_CORE=a53 +elif [ "$BUILDTYPE" = "bookworm-j7200-evm" ]; then + ARM_A_CORE=a72 +else + echo "=== E: $0: Undefined BUILDTARG:BUILDTYPE ($BUILDTARG:$BUILDTYPE)" + exit 1 +fi + function build_bsp() { build=$1 machine=$2 @@ -62,10 +75,10 @@ bsp_version=$3 --single-branch \ --depth=1 &>>"${LOG_FILE}" log ">> ti-u-boot: cloned" - if [ -d ${topdir}/patches/ti-u-boot ]; then + if [ -d ${topdir}/ti-bdebstrap/patches/ti-u-boot ]; then log ">> ti-u-boot: patching .." cd ti-u-boot - git apply ${topdir}/patches/ti-u-boot/* &>>"${LOG_FILE}" + git apply ${topdir}/ti-bdebstrap/patches/ti-u-boot/* &>>"${LOG_FILE}" cd .. fi else @@ -131,7 +144,8 @@ bsp_version=$2 uboot_r5_defconfig=($(read_machine_config ${machine} uboot_r5_defconfig ${bsp_version})) uboot_r5_defconfig=`echo $uboot_r5_defconfig | tr ',' ' '` - uboot_a53_defconfig=($(read_machine_config ${machine} uboot_a53_defconfig ${bsp_version})) + uboot_acore_defconfig=($(read_machine_config ${machine} uboot_${ARM_A_CORE}_defconfig ${bsp_version})) + platform=($(read_machine_config ${machine} atf_target_board ${bsp_version})) cd ${UBOOT_DIR} log "> uboot-r5: building .." @@ -140,11 +154,11 @@ bsp_version=$2 cp ${UBOOT_DIR}/out/r5/tiboot3*.bin ${topdir}/build/${build}/tisdk-debian-${distro}-${bsp_version}-boot/ &>> ${LOG_FILE} cd ${UBOOT_DIR} - log "> uboot-a53: building .." - make -j`nproc` ARCH=arm CROSS_COMPILE=${cross_compile} ${uboot_a53_defconfig} O=${UBOOT_DIR}/out/a53 &>>"${LOG_FILE}" - make -j`nproc` ARCH=arm CROSS_COMPILE=${cross_compile} BL31=${TFA_DIR}/build/k3/lite/release/bl31.bin TEE=${OPTEE_DIR}/out/arm-plat-k3/core/tee-pager_v2.bin O=${UBOOT_DIR}/out/a53 BINMAN_INDIRS=${topdir}/build/${build}/bsp_sources/ti-linux-firmware &>>"${LOG_FILE}" - cp ${UBOOT_DIR}/out/a53/tispl.bin ${topdir}/build/${build}/tisdk-debian-${distro}-${bsp_version}-boot/ &>> ${LOG_FILE} - cp ${UBOOT_DIR}/out/a53/u-boot.img ${topdir}/build/${build}/tisdk-debian-${distro}-${bsp_version}-boot/ &>> ${LOG_FILE} + log "> uboot-${ARM_A_CORE}: building .." + make -j`nproc` ARCH=arm CROSS_COMPILE=${cross_compile} ${uboot_acore_defconfig} O=${UBOOT_DIR}/out/${ARM_A_CORE} &>>"${LOG_FILE}" + make -j`nproc` ARCH=arm CROSS_COMPILE=${cross_compile} BL31=${TFA_DIR}/build/k3/${platform}/release/bl31.bin TEE=${OPTEE_DIR}/out/arm-plat-k3/core/tee-pager_v2.bin BINMAN_INDIRS=${FW_DIR} O=${UBOOT_DIR}/out/${ARM_A_CORE} &>>"${LOG_FILE}" + cp ${UBOOT_DIR}/out/${ARM_A_CORE}/tispl.bin ${topdir}/build/${build}/tisdk-debian-${distro}-${bsp_version}-boot/ &>> ${LOG_FILE} + cp ${UBOOT_DIR}/out/${ARM_A_CORE}/u-boot.img ${topdir}/build/${build}/tisdk-debian-${distro}-${bsp_version}-boot/ &>> ${LOG_FILE} case ${machine} in am62pxx-evm | am62xx-evm | am62xx-lp-evm | am62xxsip-evm) diff --git a/scripts/build_distroiGOS.sh b/scripts/build_distroiGOS.sh index e074e79..966c789 100755 --- a/scripts/build_distroiGOS.sh +++ b/scripts/build_distroiGOS.sh @@ -33,8 +33,11 @@ bsp_version=$2 cp -ra ../fs/ tisdk-debian-${distro}-${bsp_version}-rootfs log "> Cleaning up ${build}" - tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-rootfs.tar.xz tisdk-debian-${distro}-${bsp_version}-rootfs &>>"${LOG_FILE}" - rm -rf tisdk-debian-${distro}-rootfs +# If we tar file system, it cause to be missing special file capabilities. (by Dennis Kong). +# So we will not tar it and copy the folder to SD card directly (Inside "create-sdcardiGOS.sh" line 715) +# refer to commit 351c0c1cbc1189fb659295251674e51799dd8be4 +# tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-rootfs.tar.xz tisdk-debian-${distro}-${bsp_version}-rootfs &>>"${LOG_FILE}" +# rm -rf tisdk-debian-${distro}-${bsp_version}-rootfs tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-boot.tar.xz tisdk-debian-${distro}-${bsp_version}-boot &>>"${LOG_FILE}" rm -rf tisdk-debian-${distro}-${bsp_version}-boot From be10d5eb6c177e9ec4def790932e2ce1bc278fa8 Mon Sep 17 00:00:00 2001 From: Dennis Kong Date: Fri, 21 Feb 2025 14:43:29 -0500 Subject: [PATCH 7/7] Changes to squash and save boot and rootfs images to per-target folders and to use them when burning an sdcard --- create-sdcardiGOS.sh | 14 ++++++++------ scripts/build_distroiGOS.sh | 12 ++++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/create-sdcardiGOS.sh b/create-sdcardiGOS.sh index 4f4e953..25049e1 100755 --- a/create-sdcardiGOS.sh +++ b/create-sdcardiGOS.sh @@ -48,7 +48,7 @@ EXEPATH="$PWD"/"$EXE" clear build=${1} -PARSEPATH=./build/${build} +PARSEPATH=./images/${build} cat << EOM @@ -691,9 +691,9 @@ sync sync build=* -BOOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-boot.tar.xz" -ROOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-rootfs.tar.xz" -ROOTFSPATH="$PARSEPATH/tisdk-debian-${build}-rootfs/*" +BOOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-boot.squashfs" +ROOTFILEPATH="$PARSEPATH/tisdk-debian-${build}-rootfs.squashfs" +# ROOTFSPATH="$PARSEPATH/tisdk-debian-${build}-rootfs/*" cat << EOM ################################################################################ @@ -706,13 +706,15 @@ Copying boot partition EOM -untar_progress $BOOTFILEPATH $PATH_TO_SDBOOT +# untar_progress $BOOTFILEPATH $PATH_TO_SDBOOT +unsquashfs -d $PATH_TO_SDBOOT $BOOTFILEPATH echo "" sync echo "Copying rootfs System partition" -rsync -aHAX $ROOTFSPATH $PATH_TO_SDROOTFS +# rsync -aHAX $ROOTFSPATH $PATH_TO_SDROOTFS +unsquashfs -d $PATH_TO_SDROOTFS $ROOTFILEPATH echo "" echo "" diff --git a/scripts/build_distroiGOS.sh b/scripts/build_distroiGOS.sh index 966c789..06a12cb 100755 --- a/scripts/build_distroiGOS.sh +++ b/scripts/build_distroiGOS.sh @@ -28,6 +28,7 @@ function package_and_clean() { build=$1 bsp_version=$2 + mkdir -p ${topdir}/images/${build} cd ${topdir}/build/${build} rm -rf tisdk-debian-${distro}-${bsp_version}-rootfs cp -ra ../fs/ tisdk-debian-${distro}-${bsp_version}-rootfs @@ -39,8 +40,15 @@ bsp_version=$2 # tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-rootfs.tar.xz tisdk-debian-${distro}-${bsp_version}-rootfs &>>"${LOG_FILE}" # rm -rf tisdk-debian-${distro}-${bsp_version}-rootfs - tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-boot.tar.xz tisdk-debian-${distro}-${bsp_version}-boot &>>"${LOG_FILE}" - rm -rf tisdk-debian-${distro}-${bsp_version}-boot +# latest changes to save the boot and rootfs inside squashfs files that preserve capabilites and file attrs and allows portability in burning an sdcard + mksquashfs tisdk-debian-${distro}-${bsp_version}-rootfs tisdk-debian-${distro}-${bsp_version}-rootfs.squashfs -comp xz -noappend &>>"${LOG_FILE}" + mv tisdk-debian-${distro}-${bsp_version}-rootfs.squashfs ${topdir}/images/${build} + +# tar --use-compress-program="pigz --best --recursive | pv" -cf tisdk-debian-${distro}-${bsp_version}-boot.tar.xz tisdk-debian-${distro}-${bsp_version}-boot &>>"${LOG_FILE}" +# rm -rf tisdk-debian-${distro}-${bsp_version}-boot + + mksquashfs tisdk-debian-${distro}-${bsp_version}-boot tisdk-debian-${distro}-${bsp_version}-boot.squashfs -comp xz -noappend &>>"${LOG_FILE}" + mv tisdk-debian-${distro}-${bsp_version}-boot.squashfs ${topdir}/images/${build} rm -rf bsp_sources