Some extra features for convenience (#209)
* Enable setting modprobed-db database path This enables using different dbs and be able to build the kernel for others, with modprobed-db * Save generated .config file back to user's git folder, for eventual re-use * Set local version for all distros * install.sh: handle user provided .config files Update dosctring for the _configfile var in customization.cfg * install.sh: fix kernel version prompt broken newlines * Copy final config file as kernelconfig.new
This commit is contained in:
parent
fde290233a
commit
b595006ffb
@ -44,6 +44,9 @@ _noccache="false"
|
|||||||
# !!!! Make sure to have a well populated db !!!! - Leave empty to be asked about it at build time
|
# !!!! Make sure to have a well populated db !!!! - Leave empty to be asked about it at build time
|
||||||
_modprobeddb="false"
|
_modprobeddb="false"
|
||||||
|
|
||||||
|
# modprobed-db database file location
|
||||||
|
_modprobeddb_db_path=~/.config/modprobed.db
|
||||||
|
|
||||||
# Set to "1" to call make menuconfig, "2" to call make nconfig, "3" to call make xconfig, before building the kernel. Set to false to disable and skip the prompt.
|
# Set to "1" to call make menuconfig, "2" to call make nconfig, "3" to call make xconfig, before building the kernel. Set to false to disable and skip the prompt.
|
||||||
_menunconfig=""
|
_menunconfig=""
|
||||||
|
|
||||||
@ -55,9 +58,17 @@ _diffconfig_name=""
|
|||||||
|
|
||||||
#### KERNEL OPTIONS ####
|
#### KERNEL OPTIONS ####
|
||||||
|
|
||||||
# [Arch specific] Name of the default config file to use from the linux???-tkg-config folder.
|
# Name of the default config file to use for the kernel
|
||||||
# Default is "config.x86_64" and Arch hardened is "config_hardened.x86_64".
|
# Default (empty):
|
||||||
# To get a complete hardened setup, you have to use "cfs" as _cpusched
|
# - Archlinux (PKGBUILD): "config.x86_64" from the linux-tkg-config/5.y folder.
|
||||||
|
# - install.sh: Picks the .config file from the currently running kernel.
|
||||||
|
# It is recommended to be running an official kernel before running this script, to pick off a correct .config file
|
||||||
|
# User provided:
|
||||||
|
# - Archlinux : use "config_hardened.x86_64" to get a hardened kernel. To get a complete hardened setup, you have to use "cfs" as _cpusched.
|
||||||
|
# - Any : custom user provided file, the given path should be relative to the PKGBUILD file. This enables for example to use a user stripped down .config file.
|
||||||
|
# If the .config file isn't up to date with the chosen kernel version, any extra CONFIG_XXXX is set to its default value.
|
||||||
|
# Note: the script copies the resulting .config file as "kernelconfig.new" next to the PKGBUILD as a convenience for an eventual re-use. It gets overwritten at each run.
|
||||||
|
# One can use "kernelconfig.new" here to always use the latest edited .config file. modprobed-db needs to be used only once for its changes to be picked up.
|
||||||
_configfile=""
|
_configfile=""
|
||||||
|
|
||||||
# Disable some non-module debugging - See PKGBUILD for the list
|
# Disable some non-module debugging - See PKGBUILD for the list
|
||||||
|
@ -13,7 +13,7 @@ warning() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plain() {
|
plain() {
|
||||||
echo "$1" >&2
|
echo -e "$1" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
_distro_prompt() {
|
_distro_prompt() {
|
||||||
@ -260,11 +260,6 @@ if [ "$1" = "install" ] || [ "$1" = "config" ]; then
|
|||||||
# cd in linux folder, copy Ubuntu's current config file, update with new params
|
# cd in linux folder, copy Ubuntu's current config file, update with new params
|
||||||
cd "$_where"/linux-src-git
|
cd "$_where"/linux-src-git
|
||||||
|
|
||||||
if ( msg2 "Trying /boot/config-* ..." && cp /boot/config-`uname -r` .config ) || ( msg2 "Trying /proc/config.gz ..." && zcat --verbose /proc/config.gz > .config ); then
|
|
||||||
msg2 "Copying current kernel's config and running make oldconfig..."
|
|
||||||
else
|
|
||||||
msg2 "Current kernel config not found! Falling back to default..."
|
|
||||||
fi
|
|
||||||
if [ "$_distro" = "Debian" ]; then
|
if [ "$_distro" = "Debian" ]; then
|
||||||
#Help Debian cert compile problem.
|
#Help Debian cert compile problem.
|
||||||
sed -i -e 's#CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/test-signing-certs.pem"#CONFIG_SYSTEM_TRUSTED_KEYS=""#g' .config
|
sed -i -e 's#CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/test-signing-certs.pem"#CONFIG_SYSTEM_TRUSTED_KEYS=""#g' .config
|
||||||
|
@ -336,9 +336,11 @@ _tkg_srcprep() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
msg2 "Setting version..."
|
||||||
|
scripts/setlocalversion --save-scmversion
|
||||||
|
|
||||||
if [ "${_distro}" = "Arch" ]; then
|
if [ "${_distro}" = "Arch" ]; then
|
||||||
msg2 "Setting version..."
|
|
||||||
scripts/setlocalversion --save-scmversion
|
|
||||||
echo "-$pkgrel-tkg-${_cpusched}${_compiler_name}" > localversion.10-pkgrel
|
echo "-$pkgrel-tkg-${_cpusched}${_compiler_name}" > localversion.10-pkgrel
|
||||||
echo -e "Version tail set to \"-$pkgrel-tkg-${_cpusched}${_compiler_name}\"\n" > "$_where"/prepare.log
|
echo -e "Version tail set to \"-$pkgrel-tkg-${_cpusched}${_compiler_name}\"\n" > "$_where"/prepare.log
|
||||||
echo "" > localversion.20-pkgname
|
echo "" > localversion.20-pkgname
|
||||||
@ -494,11 +496,22 @@ _tkg_srcprep() {
|
|||||||
cd ${wrksrc}/linux-${_kern_ver}
|
cd ${wrksrc}/linux-${_kern_ver}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${_distro}" = "Arch" ] || [ "$_distro" = "Void" ]; then
|
|
||||||
if [ -z "${_configfile}" ]; then
|
if [ -z "${_configfile}" ]; then
|
||||||
_configfile="config.x86_64"
|
if [ "${_distro}" = "Arch" ] || [ "$_distro" = "Void" ]; then
|
||||||
|
cat "${srcdir}"/config.x86_64 > ./.config
|
||||||
|
else
|
||||||
|
if [ -f /boot/config-`uname -r` ];then
|
||||||
|
msg2 "Using /boot/config-`uname -r` as config file"
|
||||||
|
cp /boot/config-`uname -r` .config
|
||||||
|
elif [ -f /proc/config.gz ];then
|
||||||
|
msg2 "Using /proc/config.gz as config file"
|
||||||
|
zcat --verbose /proc/config.gz > .config
|
||||||
|
else
|
||||||
|
msg2 "Current kernel config not found! Falling back to default..."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
cat "${srcdir}/${_configfile}" > ./.config
|
cat "${srcdir}/${_configfile}" > ./.config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1215,7 +1228,14 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\n
|
|||||||
read -rp "`echo $' > N/y : '`" CONDITIONMPDB;
|
read -rp "`echo $' > N/y : '`" CONDITIONMPDB;
|
||||||
fi
|
fi
|
||||||
if [[ "$CONDITIONMPDB" =~ [yY] ]] || [ "$_modprobeddb" = "true" ]; then
|
if [[ "$CONDITIONMPDB" =~ [yY] ]] || [ "$_modprobeddb" = "true" ]; then
|
||||||
yes "" | make LSMOD=${HOME}/.config/modprobed.db localmodconfig ${llvm_opt}
|
if [ -f "$where"/"$_modprobeddb_db_path" ];then
|
||||||
|
_modprobeddb_db_path="$where"/"$_modprobeddb_db_path"
|
||||||
|
fi
|
||||||
|
if [ ! -f $_modprobeddb_db_path ]; then
|
||||||
|
msg2 "modprobed-db database not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
yes "" | make LSMOD=$_modprobeddb_db_path localmodconfig ${llvm_opt}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ true = "$_config_fragments" ]; then
|
if [ true = "$_config_fragments" ]; then
|
||||||
@ -1311,6 +1331,9 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\n
|
|||||||
make -s kernelrelease > version
|
make -s kernelrelease > version
|
||||||
msg2 "Prepared %s version %s" "$pkgbase" "$(<version)"
|
msg2 "Prepared %s version %s" "$pkgbase" "$(<version)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# copy new config file back to the user's git folder for an eventual future use
|
||||||
|
cp .config "${_where}"/kernelconfig.new
|
||||||
}
|
}
|
||||||
|
|
||||||
exit_cleanup() {
|
exit_cleanup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user