Change cl-kernel and initrd optimization for new kernel names

master
Mike Hiretsky 14 years ago
parent d49e427b3d
commit f4fa6d9baa

@ -8,7 +8,8 @@ CHANGE LOG
* Added the mounting of /var/calculate/remote by cl-builder.
* Changed isolinux template for CSS.
* Changed output kernel file names for cl-kernel.
* Add bulgarian language.
* Added bulgarian language.
* Added grub.conf changing to cl-kernel.
1.3.12
* Fix creating format a digest file.

@ -6531,6 +6531,11 @@ sub initrd_clean{
# получим имя файла конфигурации текущего ядра
my $config=`file -L $chroot$data{scratch_ws}/boot/vmlinuz`;
$config =~ s/^.*version ([^ ]+) .*$/$chroot$data{scratch_ws}\/boot\/config-\1/;
if(!-e $config ) {
$config=`file -L $chroot$data{scratch_ws}/boot/vmlinuz`;
$config =~ s/^.*version ([^ ]+) .*$/$chroot$data{scratch_ws}\/boot\/config-\1-$data{march}-$data{calculate}/;
$config =~ s/-calculate//;
}
# получим список внешних модулей в ядре в chroot
my @list_chroot_m=get_kernel_config(scalar `cat $config`,"m");

@ -84,6 +84,32 @@ set_kernel_version() {
set_param EXTRAVERSION $KV_TYPE ${KERNEL_DIR}/Makefile
}
get_stdin_value() {
sed -rn "s/^(.*\s+)?+$1=\"?([^\" ]*)\"?(\s+.*|$)/\2/p"
}
change_kernel_in_grub() {
local ROOTDEV=$( get_stdin_value root < /proc/cmdline )
local NAMESUFFIX=$1
[[ -f /boot/vmlinuz-${NAMESUFFIX} ]] &&
[[ -f /boot/initramfs-${NAMESUFFIX} ]] &&
[[ -f /boot/initramfs-${NAMESUFFIX}-install ]] &&
[[ -f /boot/grub/grub.conf ]] &&
sed -ri "/^title/{ #find title in grub.conf
:readnextline;N; #read next line
s/\ninitrd/&/; #if pattern not contents initrd
Treadnextline; #goto read next line
:changemenuitem; #else try change menuitem
s|root=${ROOTDEV}|&|; #if menuitem not for the system
Tskipmenuitem; #then skip menuitem
s|(/boot/vmlinuz)[^ ]+|\1-${NAMESUFFIX}|; #else change vmlinuz
s|initrd (.*)-install$|initrd \1/install|; #hide '-install'
s|(/boot/initramfs)[^ /]+|\1-${NAMESUFFIX}|; #change initramfs
s|/install$|-install|; #show '-install'
:skipmenuitem;
}" /boot/grub/grub.conf
}
initramfs_unpack() {
mkdir -p tmp/initramfs ||
die "Catn't create temporary directory for initramfs"
@ -186,6 +212,7 @@ install_kernel() {
${BOOT_DIR}/initramfs-${NEW_KERNEL_VERSION}-install
ln -sf initramfs-${NEW_KERNEL_VERSION}-install ${BOOT_DIR}/initrd-install
cp ${KERNEL_DIR}/.config ${BOOT_DIR}/config-${NEW_KERNEL_VERSION}
change_kernel_in_grub ${NEW_KERNEL_VERSION}
}
KERNEL_DIR=/usr/src/linux
@ -342,11 +369,11 @@ initramfs_clean
initramfs_pack
install_kernel
set_new_current_kernel
calculate --initrd
/usr/calculate/install/calculate --initrd
if [[ "$(md5sum /boot/initrd | awk '{print $1}')" == \
"$(md5sum /boot/initrd-install | awk '{print $1}')" ]]
then
echo
echo "Perform command after reboot for optimization initramfs:"
echo " calculate --initrd"
echo " /usr/calculate/install/calculate --initrd"
fi

Loading…
Cancel
Save