mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Add USERPATCHES_PATH optional setting to config file. (#1450)
Required if userpatches folder is conflicted between two different configs. This is frequent and requires maintaining two copies of the builder.
This commit is contained in:
committed by
lanefu
parent
94027c0f58
commit
bc0fbb85bc
2
.gitignore
vendored
2
.gitignore
vendored
@@ -15,7 +15,7 @@ ubuntu-*-cloudimg-console.log
|
|||||||
/.tmp/
|
/.tmp/
|
||||||
/output/
|
/output/
|
||||||
/cache/
|
/cache/
|
||||||
/userpatches/
|
/*userpatches*/
|
||||||
|
|
||||||
### General annoyances ###
|
### General annoyances ###
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ else
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "${SRC}"/config-default.conf
|
source "${SRC}"/config-default.conf
|
||||||
fi
|
fi
|
||||||
|
[[ -z "${USERPATCHES_PATH}" ]] && USERPATCHES_PATH="$SRC/userpatches"
|
||||||
|
|
||||||
if [[ $EUID != 0 ]]; then
|
if [[ $EUID != 0 ]]; then
|
||||||
display_alert "This script requires root privileges, trying to use sudo" "" "wrn"
|
display_alert "This script requires root privileges, trying to use sudo" "" "wrn"
|
||||||
|
|||||||
@@ -316,9 +316,9 @@ compile_kernel()
|
|||||||
display_alert "Using previous kernel config" "$DEST/config/$LINUXCONFIG.config" "info"
|
display_alert "Using previous kernel config" "$DEST/config/$LINUXCONFIG.config" "info"
|
||||||
cp $DEST/config/$LINUXCONFIG.config .config
|
cp $DEST/config/$LINUXCONFIG.config .config
|
||||||
else
|
else
|
||||||
if [[ -f $SRC/userpatches/$LINUXCONFIG.config ]]; then
|
if [[ -f $USERPATCHES_PATH/$LINUXCONFIG.config ]]; then
|
||||||
display_alert "Using kernel config provided by user" "userpatches/$LINUXCONFIG.config" "info"
|
display_alert "Using kernel config provided by user" "userpatches/$LINUXCONFIG.config" "info"
|
||||||
cp $SRC/userpatches/$LINUXCONFIG.config .config
|
cp $USERPATCHES_PATH/$LINUXCONFIG.config .config
|
||||||
else
|
else
|
||||||
display_alert "Using kernel config file" "config/kernel/$LINUXCONFIG.config" "info"
|
display_alert "Using kernel config file" "config/kernel/$LINUXCONFIG.config" "info"
|
||||||
cp $SRC/config/kernel/$LINUXCONFIG.config .config
|
cp $SRC/config/kernel/$LINUXCONFIG.config .config
|
||||||
@@ -515,10 +515,10 @@ find_toolchain()
|
|||||||
# <description>: additional description text
|
# <description>: additional description text
|
||||||
#
|
#
|
||||||
# priority:
|
# priority:
|
||||||
# $SRC/userpatches/<dest>/<family>/target_<target>
|
# $USERPATCHES_PATH/<dest>/<family>/target_<target>
|
||||||
# $SRC/userpatches/<dest>/<family>/board_<board>
|
# $USERPATCHES_PATH/<dest>/<family>/board_<board>
|
||||||
# $SRC/userpatches/<dest>/<family>/branch_<branch>
|
# $USERPATCHES_PATH/<dest>/<family>/branch_<branch>
|
||||||
# $SRC/userpatches/<dest>/<family>
|
# $USERPATCHES_PATH/<dest>/<family>
|
||||||
# $SRC/patch/<dest>/<family>/target_<target>
|
# $SRC/patch/<dest>/<family>/target_<target>
|
||||||
# $SRC/patch/<dest>/<family>/board_<board>
|
# $SRC/patch/<dest>/<family>/board_<board>
|
||||||
# $SRC/patch/<dest>/<family>/branch_<branch>
|
# $SRC/patch/<dest>/<family>/branch_<branch>
|
||||||
@@ -538,10 +538,10 @@ advanced_patch()
|
|||||||
|
|
||||||
local names=()
|
local names=()
|
||||||
local dirs=(
|
local dirs=(
|
||||||
"$SRC/userpatches/$dest/$family/target_${target}:[\e[33mu\e[0m][\e[34mt\e[0m]"
|
"$USERPATCHES_PATH/$dest/$family/target_${target}:[\e[33mu\e[0m][\e[34mt\e[0m]"
|
||||||
"$SRC/userpatches/$dest/$family/board_${board}:[\e[33mu\e[0m][\e[35mb\e[0m]"
|
"$USERPATCHES_PATH/$dest/$family/board_${board}:[\e[33mu\e[0m][\e[35mb\e[0m]"
|
||||||
"$SRC/userpatches/$dest/$family/branch_${branch}:[\e[33mu\e[0m][\e[33mb\e[0m]"
|
"$USERPATCHES_PATH/$dest/$family/branch_${branch}:[\e[33mu\e[0m][\e[33mb\e[0m]"
|
||||||
"$SRC/userpatches/$dest/$family:[\e[33mu\e[0m][\e[32mc\e[0m]"
|
"$USERPATCHES_PATH/$dest/$family:[\e[33mu\e[0m][\e[32mc\e[0m]"
|
||||||
"$SRC/patch/$dest/$family/target_${target}:[\e[32ml\e[0m][\e[34mt\e[0m]"
|
"$SRC/patch/$dest/$family/target_${target}:[\e[32ml\e[0m][\e[34mt\e[0m]"
|
||||||
"$SRC/patch/$dest/$family/board_${board}:[\e[32ml\e[0m][\e[35mb\e[0m]"
|
"$SRC/patch/$dest/$family/board_${board}:[\e[32ml\e[0m][\e[35mb\e[0m]"
|
||||||
"$SRC/patch/$dest/$family/branch_${branch}:[\e[32ml\e[0m][\e[33mb\e[0m]"
|
"$SRC/patch/$dest/$family/branch_${branch}:[\e[32ml\e[0m][\e[33mb\e[0m]"
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ DESTIMG="${SRC}/.tmp/image-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}"
|
|||||||
|
|
||||||
source "${SRC}/config/sources/${LINUXFAMILY}.conf"
|
source "${SRC}/config/sources/${LINUXFAMILY}.conf"
|
||||||
|
|
||||||
if [[ -f ${SRC}/userpatches/sources/$LINUXFAMILY.conf ]]; then
|
if [[ -f $USERPATCHES_PATH/sources/$LINUXFAMILY.conf ]]; then
|
||||||
display_alert "Adding user provided $LINUXFAMILY overrides"
|
display_alert "Adding user provided $LINUXFAMILY overrides"
|
||||||
source "${SRC}/userpatches/sources/${LINUXFAMILY}.conf"
|
source "$USERPATCHES_PATH/sources/${LINUXFAMILY}.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# dropbear needs to be configured differently
|
# dropbear needs to be configured differently
|
||||||
@@ -220,9 +220,9 @@ if [[ $DOWNLOAD_MIRROR == china ]] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# For user override
|
# For user override
|
||||||
if [[ -f ${SRC}/userpatches/lib.config ]]; then
|
if [[ -f $USERPATCHES_PATH/lib.config ]]; then
|
||||||
display_alert "Using user configuration override" "userpatches/lib.config" "info"
|
display_alert "Using user configuration override" "userpatches/lib.config" "info"
|
||||||
source "${SRC}"/userpatches/lib.config
|
source "$USERPATCHES_PATH"/lib.config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# apt-cacher-ng mirror configurarion
|
# apt-cacher-ng mirror configurarion
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ install_common()
|
|||||||
[[ -f $SDCARD/etc/dropbear-initramfs/config ]] && sed -i 's/^#DROPBEAR_OPTIONS=/DROPBEAR_OPTIONS="-p '"${CRYPTROOT_SSH_UNLOCK_PORT}"'"/' "${SDCARD}"/etc/dropbear-initramfs/config
|
[[ -f $SDCARD/etc/dropbear-initramfs/config ]] && sed -i 's/^#DROPBEAR_OPTIONS=/DROPBEAR_OPTIONS="-p '"${CRYPTROOT_SSH_UNLOCK_PORT}"'"/' "${SDCARD}"/etc/dropbear-initramfs/config
|
||||||
|
|
||||||
# setup dropbear authorized_keys, either provided by userpatches or generated
|
# setup dropbear authorized_keys, either provided by userpatches or generated
|
||||||
if [[ -f $SRC/userpatches/dropbear_authorized_keys ]]; then
|
if [[ -f $USERPATCHES_PATH/dropbear_authorized_keys ]]; then
|
||||||
cp "${SRC}"/userpatches/dropbear_authorized_keys "${SDCARD}"/etc/dropbear-initramfs/authorized_keys
|
cp "$USERPATCHES_PATH"/dropbear_authorized_keys "${SDCARD}"/etc/dropbear-initramfs/authorized_keys
|
||||||
else
|
else
|
||||||
# generate a default ssh key for login on dropbear in initramfs
|
# generate a default ssh key for login on dropbear in initramfs
|
||||||
# this key should be changed by the user on first login
|
# this key should be changed by the user on first login
|
||||||
@@ -139,8 +139,8 @@ install_common()
|
|||||||
# instead of copying sunxi-specific template
|
# instead of copying sunxi-specific template
|
||||||
if [[ $ROOTFS_TYPE == nfs ]]; then
|
if [[ $ROOTFS_TYPE == nfs ]]; then
|
||||||
display_alert "Copying NFS boot script template"
|
display_alert "Copying NFS boot script template"
|
||||||
if [[ -f $SRC/userpatches/nfs-boot.cmd ]]; then
|
if [[ -f $USERPATCHES_PATH/nfs-boot.cmd ]]; then
|
||||||
cp "${SRC}"/userpatches/nfs-boot.cmd "${SDCARD}"/boot/boot.cmd
|
cp "$USERPATCHES_PATH"/nfs-boot.cmd "${SDCARD}"/boot/boot.cmd
|
||||||
else
|
else
|
||||||
cp "${SRC}"/config/templates/nfs-boot.cmd.template "${SDCARD}"/boot/boot.cmd
|
cp "${SRC}"/config/templates/nfs-boot.cmd.template "${SDCARD}"/boot/boot.cmd
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ fel_prepare_host()
|
|||||||
|
|
||||||
fel_prepare_target()
|
fel_prepare_target()
|
||||||
{
|
{
|
||||||
if [[ -f $SRC/userpatches/fel-boot.cmd ]]; then
|
if [[ -f $USERPATCHES_PATH/fel-boot.cmd ]]; then
|
||||||
display_alert "Using custom boot script" "userpatches/fel-boot.cmd" "info"
|
display_alert "Using custom boot script" "userpatches/fel-boot.cmd" "info"
|
||||||
cp "${SRC}"/userpatches/fel-boot.cmd "${FEL_ROOTFS}"/boot/boot.cmd
|
cp "$USERPATCHES_PATH"/fel-boot.cmd "${FEL_ROOTFS}"/boot/boot.cmd
|
||||||
else
|
else
|
||||||
cp "${SRC}"/config/templates/fel-boot.cmd.template "${FEL_ROOTFS}"/boot/boot.cmd
|
cp "${SRC}"/config/templates/fel-boot.cmd.template "${FEL_ROOTFS}"/boot/boot.cmd
|
||||||
fi
|
fi
|
||||||
@@ -72,10 +72,10 @@ fel_load()
|
|||||||
write 0x43100000 "${FEL_ROOTFS}"/boot/boot.scr
|
write 0x43100000 "${FEL_ROOTFS}"/boot/boot.scr
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -f $SRC/userpatches/fel-hooks.sh ]]; then
|
if [[ -f $USERPATCHES_PATH/fel-hooks.sh ]]; then
|
||||||
display_alert "Using additional FEL hooks in" "userpatches/fel-hooks.sh" "info"
|
display_alert "Using additional FEL hooks in" "userpatches/fel-hooks.sh" "info"
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "${SRC}"/userpatches/fel-hooks.sh
|
source "$USERPATCHES_PATH"/fel-hooks.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# basic sanity check
|
# basic sanity check
|
||||||
|
|||||||
@@ -642,18 +642,16 @@ prepare_host()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# create directory structure
|
# create directory structure
|
||||||
mkdir -p $SRC/{cache,output,userpatches}
|
mkdir -p $SRC/{cache,output} $USERPATCHES_PATH
|
||||||
if [[ -n $SUDO_USER ]]; then
|
if [[ -n $SUDO_USER ]]; then
|
||||||
chgrp --quiet sudo cache output userpatches
|
chgrp --quiet sudo cache output $USERPATCHES_PATH
|
||||||
# SGID bit on cache/sources breaks kernel dpkg packaging
|
# SGID bit on cache/sources breaks kernel dpkg packaging
|
||||||
chmod --quiet g+w,g+s output userpatches
|
chmod --quiet g+w,g+s output $USERPATCHES_PATH
|
||||||
# fix existing permissions
|
# fix existing permissions
|
||||||
find $SRC/output $SRC/userpatches -type d ! -group sudo -exec chgrp --quiet sudo {} \;
|
find $SRC/output $USERPATCHES_PATH -type d ! -group sudo -exec chgrp --quiet sudo {} \;
|
||||||
find $SRC/output $SRC/userpatches -type d ! -perm -g+w,g+s -exec chmod --quiet g+w,g+s {} \;
|
find $SRC/output $USERPATCHES_PATH -type d ! -perm -g+w,g+s -exec chmod --quiet g+w,g+s {} \;
|
||||||
fi
|
fi
|
||||||
mkdir -p $DEST/debs/extra $DEST/{config,debug,patch} $SRC/userpatches/overlay $SRC/cache/{sources,toolchains,utility,rootfs} $SRC/.tmp
|
mkdir -p $DEST/debs/extra $DEST/{config,debug,patch} $USERPATCHES_PATH/overlay $SRC/cache/{sources,toolchains,utility,rootfs} $SRC/.tmp
|
||||||
|
|
||||||
find $SRC/patch -type d ! -name . | sed "s%/patch%/userpatches%" | xargs mkdir -p
|
|
||||||
|
|
||||||
display_alert "Checking for external GCC compilers" "" "info"
|
display_alert "Checking for external GCC compilers" "" "info"
|
||||||
# download external Linaro compiler and missing special dependencies since they are needed for certain sources
|
# download external Linaro compiler and missing special dependencies since they are needed for certain sources
|
||||||
@@ -698,12 +696,12 @@ prepare_host()
|
|||||||
# download etcher CLI utility
|
# download etcher CLI utility
|
||||||
download_etcher_cli
|
download_etcher_cli
|
||||||
|
|
||||||
[[ ! -f $SRC/userpatches/customize-image.sh ]] && cp $SRC/config/templates/customize-image.sh.template $SRC/userpatches/customize-image.sh
|
[[ ! -f $USERPATCHES_PATH/customize-image.sh ]] && cp $SRC/config/templates/customize-image.sh.template $USERPATCHES_PATH/customize-image.sh
|
||||||
|
|
||||||
if [[ ! -f $SRC/userpatches/README ]]; then
|
if [[ ! -f $USERPATCHES_PATH/README ]]; then
|
||||||
rm -f $SRC/userpatches/readme.txt
|
rm -f $USERPATCHES_PATH/readme.txt
|
||||||
echo 'Please read documentation about customizing build configuration' > $SRC/userpatches/README
|
echo 'Please read documentation about customizing build configuration' > $USERPATCHES_PATH/README
|
||||||
echo 'http://www.armbian.com/using-armbian-tools/' >> $SRC/userpatches/README
|
echo 'http://www.armbian.com/using-armbian-tools/' >> $USERPATCHES_PATH/README
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check free space (basic)
|
# check free space (basic)
|
||||||
|
|||||||
@@ -107,12 +107,12 @@ write_uboot()
|
|||||||
customize_image()
|
customize_image()
|
||||||
{
|
{
|
||||||
# for users that need to prepare files at host
|
# for users that need to prepare files at host
|
||||||
[[ -f $SRC/userpatches/customize-image-host.sh ]] && source "${SRC}"/userpatches/customize-image-host.sh
|
[[ -f $USERPATCHES_PATH/customize-image-host.sh ]] && source "$USERPATCHES_PATH"/customize-image-host.sh
|
||||||
cp "${SRC}"/userpatches/customize-image.sh "${SDCARD}"/tmp/customize-image.sh
|
cp "$USERPATCHES_PATH"/customize-image.sh "${SDCARD}"/tmp/customize-image.sh
|
||||||
chmod +x "${SDCARD}"/tmp/customize-image.sh
|
chmod +x "${SDCARD}"/tmp/customize-image.sh
|
||||||
mkdir -p "${SDCARD}"/tmp/overlay
|
mkdir -p "${SDCARD}"/tmp/overlay
|
||||||
# util-linux >= 2.27 required
|
# util-linux >= 2.27 required
|
||||||
mount -o bind,ro "${SRC}"/userpatches/overlay "${SDCARD}"/tmp/overlay
|
mount -o bind,ro "$USERPATCHES_PATH"/overlay "${SDCARD}"/tmp/overlay
|
||||||
display_alert "Calling image customization script" "customize-image.sh" "info"
|
display_alert "Calling image customization script" "customize-image.sh" "info"
|
||||||
chroot "${SDCARD}" /bin/bash -c "/tmp/customize-image.sh $RELEASE $LINUXFAMILY $BOARD $BUILD_DESKTOP"
|
chroot "${SDCARD}" /bin/bash -c "/tmp/customize-image.sh $RELEASE $LINUXFAMILY $BOARD $BUILD_DESKTOP"
|
||||||
CUSTOMIZE_IMAGE_RC=$?
|
CUSTOMIZE_IMAGE_RC=$?
|
||||||
|
|||||||
Reference in New Issue
Block a user