Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ If called without arguments, installs stable kernel using /opt/linux
--dir |-d install directory
--kexec |-x load new kernel without reboot
--config |-c set configuration target
--custom-config |-cc set custom configuration directive, can be used multiple times
--verbose |-v increase verbosity
--get-verified-tarball |-gvt cryptographically verify kernel tarball
--nproc |-n set the number of processing units to use
Expand Down Expand Up @@ -149,6 +150,18 @@ kvmconfig - Enable additional options for guest kernel support
tinyconfig - Configure the tiniest possible kernel
```

### Custom configuration directives

In order to enable specific kernel configs, one can use `--custom-config` like the following example:
```
./kernel_installer.sh --custom-config "scripts/config --set-val CONFIG_DM_VDO m"
```

Note that `--custom-config can be used multiple times like:
```
./kernel_installer.sh --custom-config "scripts/config --set-val CONFIG_DM_VDO m" --custom-config "scripts/config --set-val CONFIG_KERNEL_ZSTD y"
```

To use --get-verified-tarball:
```bash
./kernel_installer.sh --get-verified-tarball
Expand Down
20 changes: 19 additions & 1 deletion kernel_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
######################################################################


VERSION='1.2.5'
VERSION='1.2.6-dev'

#------------------------------------------------------------------------------#
#
Expand Down Expand Up @@ -351,6 +351,7 @@ usage() {
printf "%s\\n" " ${YELLOW}--dir |-d${NORMAL} install directory"
printf "%s\\n" " ${YELLOW}--kexec |-x${NORMAL} load new kernel without reboot"
printf "%s\\n" " ${YELLOW}--config |-c${NORMAL} set configuration target"
printf "%s\\n" " ${YELLOW}--custom-config |-cc${NORMAL} set custom configuration directive, can be used multiple times"
printf "%s\\n" " ${YELLOW}--verbose |-v${NORMAL} increase verbosity"
printf "%s\\n" " ${YELLOW}--get-verified-tarball |-gvt${NORMAL} cryptographically verify kernel tarball"
printf "%s\\n" " ${YELLOW}--nproc |-n${NORMAL} set the number of processing units to use"
Expand All @@ -367,6 +368,7 @@ usage() {
}

POSITIONAL_ARGS=()
CUSTOM_CONFIG_OPTIONS=()

while [[ $# -gt 0 ]]; do
case $1 in
Expand Down Expand Up @@ -413,6 +415,11 @@ while [[ $# -gt 0 ]]; do
shift
shift
;;
--custom-config | -cc)
CUSTOM_CONFIG_OPTIONS+=("$2")
shift
shift
;;
--kexec | -x)
shift
KEXEC=1
Expand Down Expand Up @@ -467,6 +474,13 @@ set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters

chk_kernel

if [ -n "$CUSTOM_CONFIG_OPTIONS" ]; then
SANITIZED_CUSTOM_CONFIG_OPTIONS=()
for custom_config_option in "${CUSTOM_CONFIG_OPTIONS[@]}"; do
SANITIZED_CUSTOM_CONFIG_OPTIONS+=("$(echo "$custom_config_option")")
done
fi

# Start with a clean log
if [[ -f $LOGFILE ]]; then
rm "$LOGFILE"
Expand Down Expand Up @@ -1000,6 +1014,10 @@ install_kernel() {
scripts/config --enable CONFIG_ZRAM_BACKEND_842
scripts/config --enable CONFIG_ZRAM_BACKEND_LZO
fi
for custom_config_option in "${SANITIZED_CUSTOM_CONFIG_OPTIONS[@]}"; do
log_debug "Adding custom config option: \"$custom_config_option\""
eval "$custom_config_option"
done
echo
# Compilation
log_debug "Phase 5 of 6: Compilation"
Expand Down