|
|
|
@ -5,26 +5,23 @@ progname=cl-kernel
|
|
|
|
|
OVERLAY_DIRECTORY="/usr/local/portage/layman/calculate"
|
|
|
|
|
KERNEL_CONFIG_DIR="${OVERLAY_DIRECTORY}/profiles/kernel"
|
|
|
|
|
|
|
|
|
|
SHORTOPTS="k:c:n:e:ho"
|
|
|
|
|
LONGOPTS="help,no-install,kerneldir:,kernel-config:,,kernel-name:,kernel-extraversion:,no-clean,menuconfig,use-own-config"
|
|
|
|
|
SHORTOPTS="k:c:e:ho"
|
|
|
|
|
LONGOPTS="help,kerneldir:,kernel-config:,extraversion:,no-clean,menuconfig,use-own-config"
|
|
|
|
|
|
|
|
|
|
print_help() {
|
|
|
|
|
cat <<'EOF'
|
|
|
|
|
Usage: cl-kernel [options] [-c FILE|-o] [destination]
|
|
|
|
|
Usage: cl-kernel [options] [-c FILE|-o]
|
|
|
|
|
|
|
|
|
|
Make kernel.
|
|
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
-h, --help Print this help message
|
|
|
|
|
-k, --kerneldir DIR Location of the kernel sources
|
|
|
|
|
-c, --kernel-config FILE Kernel configuration file to use for compilation
|
|
|
|
|
-n, --kernel-name NAME Tag the kernel and ramdisk with a name:
|
|
|
|
|
If not defined the option defaults to
|
|
|
|
|
'calculate'
|
|
|
|
|
-e, --extraversion VER Specify extraversion for kernel
|
|
|
|
|
-o, --use-own-config Use config from kernel directory.
|
|
|
|
|
--no-clean Do not run make clean before compilation
|
|
|
|
|
-h, --help Print this help message
|
|
|
|
|
-k, --kerneldir DIR Location of the kernel sources
|
|
|
|
|
--menuconfig Run menuconfig after oldconfig
|
|
|
|
|
--no-clean Do not run make clean before compilation
|
|
|
|
|
-o, --use-own-config Use config from kernel directory.
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
|
@ -132,7 +129,7 @@ initramfs_pack() {
|
|
|
|
|
make_old_file ${BOOT_DIR}/initrd
|
|
|
|
|
# pack new initramfs
|
|
|
|
|
find * | cpio -o --quiet -H newc |
|
|
|
|
|
gzip -9 >${BOOT_DIR}/initramfs-${KERNEL_NAME}-${KERNEL_VERSION} ||
|
|
|
|
|
gzip -9 >${BOOT_DIR}/initramfs-${KERNEL_VERSION} ||
|
|
|
|
|
die "Cann't pack initramfs"
|
|
|
|
|
popd &>/dev/null
|
|
|
|
|
rm -rf tmp/initramfs ||
|
|
|
|
@ -142,35 +139,14 @@ initramfs_pack() {
|
|
|
|
|
rename_kernel_systemmap() {
|
|
|
|
|
# rename kernel (remove arch from name)
|
|
|
|
|
mv ${BOOT_DIR}/kernel-${KERNEL_NAME}-*-${KERNEL_VERSION} \
|
|
|
|
|
${BOOT_DIR}/linux-${KERNEL_NAME}-${KERNEL_VERSION} ||
|
|
|
|
|
${BOOT_DIR}/vmlinuz-${KERNEL_VERSION} ||
|
|
|
|
|
die "Cann't rename kernel"
|
|
|
|
|
# rename systemmap (remove arch from name)
|
|
|
|
|
mv ${BOOT_DIR}/System.map-${KERNEL_NAME}-*-${KERNEL_VERSION} \
|
|
|
|
|
${BOOT_DIR}/System.map-${KERNEL_NAME}-${KERNEL_VERSION} ||
|
|
|
|
|
${BOOT_DIR}/System.map-${KERNEL_VERSION} ||
|
|
|
|
|
die "Cann't rename System.map"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
install_kernel() {
|
|
|
|
|
make_old_file ${BOOT_DIR}/System.map
|
|
|
|
|
make_old_file ${BOOT_DIR}/vmlinuz
|
|
|
|
|
rename_kernel_systemmap
|
|
|
|
|
# change kernel (make symlink)
|
|
|
|
|
ln -sf linux-${KERNEL_NAME}-${KERNEL_VERSION} ${BOOT_DIR}/vmlinuz ||
|
|
|
|
|
warning "Cann't make vmlinuz link"
|
|
|
|
|
# change System.map (make symlink)
|
|
|
|
|
ln -sf System.map-${KERNEL_NAME}-${KERNEL_VERSION} \
|
|
|
|
|
${BOOT_DIR}/System.map || warning "Cann't make System.map link"
|
|
|
|
|
# change initramfs (make symlink)
|
|
|
|
|
ln -sf initramfs-${KERNEL_NAME}-${KERNEL_VERSION} ${BOOT_DIR}/initrd ||
|
|
|
|
|
warning "Cann't make initrd link"
|
|
|
|
|
# copy config
|
|
|
|
|
make_old_file ${BOOT_DIR}/config-${KERNEL_NAME}-${KERNEL_VERSION}
|
|
|
|
|
cp ${KERNEL_CONFIG} ${BOOT_DIR}/config-${KERNEL_NAME}-${KERNEL_VERSION}
|
|
|
|
|
set_new_current_kernel
|
|
|
|
|
calculate --initrd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_new_current_kernel() {
|
|
|
|
|
# set new current kernel
|
|
|
|
|
if [[ ${KERNEL_DIR} != '/usr/src/linux' ]]
|
|
|
|
@ -191,6 +167,26 @@ set_new_current_kernel() {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
install_kernel() {
|
|
|
|
|
make_old_file ${BOOT_DIR}/System.map
|
|
|
|
|
make_old_file ${BOOT_DIR}/vmlinuz
|
|
|
|
|
rename_kernel_systemmap
|
|
|
|
|
# change kernel (make symlink)
|
|
|
|
|
ln -sf vmlinuz-${KERNEL_VERSION} ${BOOT_DIR}/vmlinuz ||
|
|
|
|
|
warning "Cann't make vmlinuz link"
|
|
|
|
|
# change System.map (make symlink)
|
|
|
|
|
ln -sf System.map-${KERNEL_VERSION} \
|
|
|
|
|
${BOOT_DIR}/System.map || warning "Cann't make System.map link"
|
|
|
|
|
# change initramfs (make symlink)
|
|
|
|
|
ln -sf initramfs-${KERNEL_VERSION} ${BOOT_DIR}/initrd ||
|
|
|
|
|
warning "Cann't make initrd link"
|
|
|
|
|
# copy config
|
|
|
|
|
make_old_file ${BOOT_DIR}/config-${KERNEL_VERSION}
|
|
|
|
|
cp ${KERNEL_CONFIG} ${BOOT_DIR}/config-${KERNEL_VERSION}
|
|
|
|
|
set_new_current_kernel
|
|
|
|
|
calculate --initrd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
make_tarball() {
|
|
|
|
|
rename_kernel_systemmap
|
|
|
|
|
# remove symlink for tarball
|
|
|
|
@ -289,21 +285,11 @@ while [ $# -gt 0 ]; do
|
|
|
|
|
KERNEL_EXTRAVERSION=$2
|
|
|
|
|
shift 2
|
|
|
|
|
;;
|
|
|
|
|
--no-install)
|
|
|
|
|
NO_INSTALL=true
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
--)
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
if [[ -z ${DESTINATION} ]]
|
|
|
|
|
then
|
|
|
|
|
DESTINATION=$1
|
|
|
|
|
shift
|
|
|
|
|
else
|
|
|
|
|
die "unknown second option: $1"
|
|
|
|
|
fi
|
|
|
|
|
die "unknown second option: $1"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|