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,43 +67,45 @@ fi ...@@ -63,43 +67,45 @@ fi
# Setup # Setup
linux_path=$(readlink -m $linux_path) linux_path=$(readlink -m $linux_path)
if [ -n "${new_config}" ]; then
if [ "$#" -ne 2 ]; then
usage
fi
old_config_path=$(readlink -m $1)
new_config_path=$(readlink -m $2)
fi
export ARCH=arm;export CROSS_COMPILE=arm-linux-gnueabihf-; export ARCH=arm;export CROSS_COMPILE=arm-linux-gnueabihf-;
cd $linux_path; cd $linux_path;
# Kernel configuration if [ -z "$partial_compile" ]; then
if [ -n "${new_config}" ]; then
if [ -n "${new_config}" ]; then
if [ "$#" -ne 2 ]; then
make mrproper; usage
cp $old_config_path $linux_path/.config; fi
make olddefconfig; old_config_path=$(readlink -m $1)
make menuconfig; new_config_path=$(readlink -m $2)
cp $linux_path/.config $new_config_path fi
elif [ -n "${update_config}" ]; then # Kernel configuration
make mrproper; if [ -n "${new_config}" ]; then
cp $config_path ${config_path}_old;
cp $config_path $linux_path/.config; make mrproper;
make olddefconfig; cp $old_config_path $linux_path/.config;
make menuconfig; make olddefconfig;
cp $linux_path/.config $config_path make menuconfig;
cp $linux_path/.config $new_config_path
else
elif [ -n "${update_config}" ]; then
make mrproper;
cp $config_path $linux_path/.config; make mrproper;
make olddefconfig; cp $config_path ${config_path}_old;
cp $config_path $linux_path/.config;
make olddefconfig;
make menuconfig;
cp $linux_path/.config $config_path
else
make mrproper;
cp $config_path $linux_path/.config;
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