Added --menu
Display or not menuconfig
This commit is contained in:
parent
36276fcf76
commit
c1939808c9
1 changed files with 48 additions and 4 deletions
|
@ -1,19 +1,48 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Some colors
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
DEFAULT='\033[0m'
|
||||
|
||||
# Defaults values
|
||||
PREFIX='linux-'
|
||||
EXTENSION='.tar.xz'
|
||||
SHOW_MENU_CONFIG=0
|
||||
|
||||
# Get last kernel version
|
||||
INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \
|
||||
/latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'`
|
||||
# Extract some values from kernel name
|
||||
KERNEL=`echo ${INFO} | cut -d' ' -f 2`
|
||||
URL=`echo ${INFO} | cut -d' ' -f 1`
|
||||
FILE=`echo ${URL}|rev|cut -d'/' -f 1 | rev`
|
||||
DIR="/usr/src/${KERNEL}"
|
||||
|
||||
# Function to script script if step fail
|
||||
isPreviousStepOk () {
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${RED} Error!${DEFAULT}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Get arguments from command line
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--menu)
|
||||
SHOW_MENU_CONFIG=1
|
||||
;;
|
||||
*)
|
||||
printf "***************************\n"
|
||||
printf "* Error: Invalid argument.*\n"
|
||||
printf "***************************\n"
|
||||
exit 1
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Make directory in /usr/src/
|
||||
DIR="/usr/src/${KERNEL}"
|
||||
mkdir "${DIR}"
|
||||
|
||||
# Install build dependancies
|
||||
|
@ -30,49 +59,64 @@ apt install \
|
|||
flex \
|
||||
bison \
|
||||
libncurses-dev \
|
||||
rsync
|
||||
rsync \
|
||||
git
|
||||
|
||||
# Go to build dir
|
||||
cd "${DIR}" || exit
|
||||
|
||||
# Get kernel archive
|
||||
wget ${URL}
|
||||
isPreviousStepOk
|
||||
|
||||
# Extract kernel archive
|
||||
tar xavf "${FILE}"
|
||||
isPreviousStepOk
|
||||
|
||||
# Enter kernel directory
|
||||
cd "linux-${KERNEL}" || exit
|
||||
cd "linux-${KERNEL}"
|
||||
isPreviousStepOk
|
||||
|
||||
# Get old config
|
||||
make olddefconfig
|
||||
isPreviousStepOk
|
||||
|
||||
# Show kernel menu
|
||||
make menuconfig
|
||||
if [ ${SHOW_MENU_CONFIG} -eq 1 ]; then
|
||||
make menuconfig
|
||||
fi
|
||||
|
||||
# Some optimizations
|
||||
./scripts/config -d CONFIG_MODULE_SIG_ALL -d CONFIG_MODULE_SIG_KEY -d CONFIG_SYSTEM_TRUSTED_KEYS
|
||||
isPreviousStepOk
|
||||
./scripts/config -d CONFIG_DEBUG_INFO
|
||||
isPreviousStepOk
|
||||
|
||||
# Compile kernel
|
||||
make deb-pkg -j"$(nproc)" LOCALVERSION=-"$(dpkg --print-architecture)" \
|
||||
KDEB_PKGVERSION="$(make kernelversion)-1"
|
||||
isPreviousStepOk
|
||||
|
||||
# Optimization
|
||||
make bindeb-pkg -j"$(nproc)" LOCALVERSION=-"$(dpkg --print-architecture)" \
|
||||
KDEB_PKGVERSION="$(make kernelversion)-1"
|
||||
isPreviousStepOk
|
||||
|
||||
# Go to parent directory
|
||||
cd ..
|
||||
|
||||
# Install new packages
|
||||
dpkg -i ./*${KERNEL}*.deb
|
||||
isPreviousStepOk
|
||||
|
||||
# Update acpi_call
|
||||
git clone git://github.com/teleshoes/acpi_call.git /tmp/acpi_call
|
||||
isPreviousStepOk
|
||||
cd /tmp/acpi_call
|
||||
make
|
||||
isPreviousStepOk
|
||||
make install
|
||||
isPreviousStepOk
|
||||
cd /tmp
|
||||
|
||||
# Clean directories
|
||||
|
|
Loading…
Reference in a new issue