Commit 25c34527 authored by Joanne Hugé's avatar Joanne Hugé

Update compile-kernel script

parent 126217da
#!/bin/bash #!/bin/bash
usage() { usage() {
echo "Usage: $0 [-hdkms] [-l LINUX_PATH] [-o OUTPUT_STR] (-u CONFIG_PATH | -c CONFIG_PATH | -n OLD_CONFIG_PATH NEW_CONFIG_PATH)" echo "Usage: $0 [-hdkms] [-l LINUX_PATH] [-o OUTPUT_STR] (-p | -u CONFIG_PATH | -c CONFIG_PATH | -n OLD_CONFIG_PATH NEW_CONFIG_PATH)"
exit 1; exit 1;
} }
linux_path=$HOME/linux linux_path=$HOME/linux
output_str="" output_str=""
while getopts "hdkmsu:c:nl:o:" opt; do while getopts "hdkmpsu:c:nl:o:" opt; do
case "${opt}" in case "${opt}" in
h ) h )
usage usage
...@@ -28,6 +28,10 @@ while getopts "hdkmsu:c:nl:o:" opt; do ...@@ -28,6 +28,10 @@ while getopts "hdkmsu:c:nl:o:" opt; do
compile_modules=1 compile_modules=1
install_opts+="-m " install_opts+="-m "
;; ;;
p )
partial_compile=1
config_set=1
;;
n ) n )
new_config=1 new_config=1
config_set=1 config_set=1
...@@ -63,21 +67,22 @@ fi ...@@ -63,21 +67,22 @@ fi
# Setup # Setup
linux_path=$(readlink -m $linux_path) linux_path=$(readlink -m $linux_path)
if [ -n "${new_config}" ]; then export ARCH=arm;export CROSS_COMPILE=arm-linux-gnueabihf-;
cd $linux_path;
if [ -z "$partial_compile" ]; then
if [ -n "${new_config}" ]; then
if [ "$#" -ne 2 ]; then if [ "$#" -ne 2 ]; then
usage usage
fi fi
old_config_path=$(readlink -m $1) old_config_path=$(readlink -m $1)
new_config_path=$(readlink -m $2) new_config_path=$(readlink -m $2)
fi fi
export ARCH=arm;export CROSS_COMPILE=arm-linux-gnueabihf-;
cd $linux_path;
# Kernel configuration # Kernel configuration
if [ -n "${new_config}" ]; then if [ -n "${new_config}" ]; then
make mrproper; make mrproper;
cp $old_config_path $linux_path/.config; cp $old_config_path $linux_path/.config;
...@@ -85,7 +90,7 @@ if [ -n "${new_config}" ]; then ...@@ -85,7 +90,7 @@ if [ -n "${new_config}" ]; then
make menuconfig; make menuconfig;
cp $linux_path/.config $new_config_path cp $linux_path/.config $new_config_path
elif [ -n "${update_config}" ]; then elif [ -n "${update_config}" ]; then
make mrproper; make mrproper;
cp $config_path ${config_path}_old; cp $config_path ${config_path}_old;
...@@ -94,12 +99,13 @@ elif [ -n "${update_config}" ]; then ...@@ -94,12 +99,13 @@ elif [ -n "${update_config}" ]; then
make menuconfig; make menuconfig;
cp $linux_path/.config $config_path cp $linux_path/.config $config_path
else else
make mrproper; make mrproper;
cp $config_path $linux_path/.config; cp $config_path $linux_path/.config;
make olddefconfig; make olddefconfig;
fi
fi fi
# Compilation # Compilation
...@@ -162,5 +168,6 @@ echo "Archive saved to $output_name.tar.gz" ...@@ -162,5 +168,6 @@ echo "Archive saved to $output_name.tar.gz"
if [ -n "$copy_to_sepia" ]; then if [ -n "$copy_to_sepia" ]; then
echo "Copying to sepia..."; echo "Copying to sepia...";
scp $output_name.tar.gz sepia:Documents/tsn-internship/img-kernel-utils/custom-kernels; scp $output_name.tar.gz sepia:Documents/tsn-internship/tsn-rt-measures/img-kernel-utils/custom-kernels;
fi fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment