Fix for use new directories

This commit is contained in:
remittor
2026-01-08 16:47:23 +03:00
parent 0aeee17021
commit 0babf26e52
2 changed files with 33 additions and 37 deletions

View File

@@ -15,7 +15,6 @@ OPT_FULL_REBUILD=false
KALLSYMS=false KALLSYMS=false
TESTING_KERNEL=false TESTING_KERNEL=false
BUILD_ONLY_INITRAMFS=false BUILD_ONLY_INITRAMFS=false
BUILD_SKIP_INITRAMFS=false
ONLY_INIT=false ONLY_INIT=false
while getopts "j:t:fiskTI" opt; do while getopts "j:t:fiskTI" opt; do
@@ -26,7 +25,6 @@ while getopts "j:t:fiskTI" opt; do
k) KALLSYMS=true;; k) KALLSYMS=true;;
T) TESTING_KERNEL=true;; T) TESTING_KERNEL=true;;
i) BUILD_ONLY_INITRAMFS=true;; i) BUILD_ONLY_INITRAMFS=true;;
s) BUILD_SKIP_INITRAMFS=true;;
I) ONLY_INIT=true;; I) ONLY_INIT=true;;
esac esac
done done
@@ -70,7 +68,7 @@ function build_target {
fi fi
inclst=$( get_cfg_inc_lst $CFG ) inclst=$( get_cfg_inc_lst $CFG )
for inc in $inclst; do for inc in $inclst; do
incfn=$XDIR/$inc incfn=$XDIR/_cfginc/$inc
[ ! -f $incfn ] && die "File '$inc' not found!" [ ! -f $incfn ] && die "File '$inc' not found!"
sed -i "/#include $inc/a <<LF>><<LF>>" $CFG sed -i "/#include $inc/a <<LF>><<LF>>" $CFG
sed -i "s/<<LF>>/\n/g" $CFG sed -i "s/<<LF>>/\n/g" $CFG
@@ -288,6 +286,9 @@ function build_target {
sed -i "s/<<ARCH>>/$TARGET_ARCH_PACKAGES/g" $OPKG_CFEED_FN sed -i "s/<<ARCH>>/$TARGET_ARCH_PACKAGES/g" $OPKG_CFEED_FN
logmsg "Added support of Fantastic packages [https://fantastic-packages.github.io/packages]" logmsg "Added support of Fantastic packages [https://fantastic-packages.github.io/packages]"
fi fi
if [ $BUILD_ONLY_INITRAMFS = true ]; then
rm -f $OPKG_DIR/customfeeds.conf
fi
SYSCTLCONF_FN=$XDIR/files/etc/sysctl.conf SYSCTLCONF_FN=$XDIR/files/etc/sysctl.conf
if [ -f $SYSCTLCONF_FN ]; then if [ -f $SYSCTLCONF_FN ]; then
@@ -317,13 +318,19 @@ function build_config {
local cfg=$1 local cfg=$1
local cfg_name=$( basename $cfg ) local cfg_name=$( basename $cfg )
local target_name=${cfg_name%.*} local target_name=${cfg_name%.*}
local initramfs=false
local board=$( get_cfg_board $cfg ) local board=$( get_cfg_board $cfg )
local subtarget=$( get_cfg_subtarget $cfg $board ) local subtarget=$( get_cfg_subtarget $cfg $board )
local device=$( get_cfg_dev_lst $cfg $board $subtarget ) local device=$( get_cfg_dev_lst $cfg $board $subtarget )
local outdir=$XDIR/bin/targets/$board/$subtarget local outdir=$XDIR/bin/targets/$board/$subtarget
echo Start build for target $cfg_name "($board-$subtarget-$device)"
build_target $cfg_name if echo "$cfg" | grep -q '_initramfs/' ; then
initramfs=true
target_name=${target_name}_initramfs
fi
echo Start build for target $target_name "($board-$subtarget-$device)"
build_target $cfg
if [ ! -f $outdir/kernel-debug.tar.zst ]; then if [ ! -f $outdir/kernel-debug.tar.zst ]; then
echo "ERROR: cannot build images for target $target_name" echo "ERROR: cannot build images for target $target_name"
@@ -338,6 +345,9 @@ function build_config {
if [ "$XTARGET" != "*" ]; then if [ "$XTARGET" != "*" ]; then
TARGETCFG=$XDIR/$XTARGET TARGETCFG=$XDIR/$XTARGET
if [ $BUILD_ONLY_INITRAMFS = true ]; then
TARGETCFG=$XDIR/_initramfs/$XTARGET
fi
XTARGET_EXT="${XTARGET##*.}" XTARGET_EXT="${XTARGET##*.}"
[ $XTARGET_EXT != config ] && TARGETCFG=$TARGETCFG.config [ $XTARGET_EXT != config ] && TARGETCFG=$TARGETCFG.config
[ ! -f $TARGETCFG ] && die "File '"`basename $TARGETCFG`"' not found!" [ ! -f $TARGETCFG ] && die "File '"`basename $TARGETCFG`"' not found!"
@@ -349,7 +359,12 @@ if [ "$XTARGET" != "*" ]; then
fi fi
XOUT=$XDIR/xout XOUT=$XDIR/xout
if [ $BUILD_ONLY_INITRAMFS = true ]; then
CFG_LIST=$( find $XDIR/_initramfs/* -maxdepth 1 -name '[a-z0-9]*.config' )
else
CFG_LIST=$( find $XDIR/* -maxdepth 1 -name '[a-z0-9]*.config' ) CFG_LIST=$( find $XDIR/* -maxdepth 1 -name '[a-z0-9]*.config' )
fi
rm -rf $XOUT rm -rf $XOUT
@@ -358,35 +373,16 @@ if [ -z "$CFG_LIST" ]; then
exit 1 exit 1
fi fi
INITRAMFS_COUNT=0 if [ $BUILD_ONLY_INITRAMFS = true ]; then
for CFG in $CFG_LIST; do
if [[ "$CFG" == *"_initramfs"* ]]; then
INITRAMFS_COUNT=$(( INITRAMFS_COUNT + 1 ))
fi
done
if [ $INITRAMFS_COUNT = 0 ] && [ $BUILD_ONLY_INITRAMFS = true ]; then
echo "ERROR: Cannot found initramfs configs!"
exit 1
fi
if [ $INITRAMFS_COUNT -gt 0 ] && [ $BUILD_SKIP_INITRAMFS != true ]; then
echo "Start make initramfs configs!" echo "Start make initramfs configs!"
clean_all else
for CFG in $CFG_LIST; do echo "Start make non initramfs configs!"
[[ "$CFG" != *"_initramfs"* ]] && continue # process only initramfs configs
build_config $CFG
done
fi fi
if [ $BUILD_ONLY_INITRAMFS != true ]; then
echo "Start make non initramfs configs!"
clean_all clean_all
for CFG in $CFG_LIST; do for CFG in $CFG_LIST; do
[[ "$CFG" == *"_initramfs"* ]] && continue # skip initramfs configs
build_config $CFG build_config $CFG
done done
fi
echo "All targets was builded!" echo "All targets was builded!"

View File

@@ -4,8 +4,8 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export XDIR=$SCRIPT_DIR export XDIR=$SCRIPT_DIR
export XADDONSDIR=$XDIR/package/addons export XADDONSDIR=$XDIR/package/addons
FEEDSDIR=$XDIR/package/feeds FEEDSDIR=$XDIR/package/feeds
ADDONSCFG=$XDIR/_addons.config ADDONSCFG=$XDIR/_cfginc/_addons.config
ADDONSNSS=$XDIR/_addons_nss.config ADDONSNSS=$XDIR/_cfginc/_addons_nss.config
. ./xcommon.sh . ./xcommon.sh