[arch-general] Howto Preserve Current Kernel through Update?

David C. Rankin drankinatty at suddenlinkmail.com
Sun Dec 12 14:17:57 EST 2010


On 12/12/2010 02:51 AM, < wrote:>
> On 12 December 2010 11:39, David C. Rankin
> <drankinatty at suddenlinkmail.com> wrote:
>> On 12/11/2010 09:34 PM, David C. Rankin wrote:
>>> mkinitcpio -k 2.6.35-dcr \
>>> -c /etc/mkinitcpio.conf \
>>> -g /boot/kernel26-dcr.img
>>>
>>> mkinitcpio -k 2.6.35-dcr \
>>> -c /etc/mkinitcpio.conf \
>>> -g /boot/kernel26-dcr-fallback.img \
>>> -S autodetect
>>
>> Of course that should be 2.6.36-dcr
> 
> You're on the right track. Two points that you have to remember:
> 
> 1) there must be modules
> 2) there must be a kernel image
> 
> Change the file names in /boot, because mkinitcpio still creates with
> the standard names. You can change the config files as well.
> 
> I created a script to install an x64 kernel alongside i686, but it's
> all about renames, so you can use it verbatim as well (if you have the
> pkg cached):
> 
> http://paste.pocoo.org/show/303829/
> 
> ./303829 $kernelpkgfile $name
> 
> Or just follow the steps and rename stuff in existing files.
> 

Thank you Ray.

	I guess the part I missed was not preserving the source directory. But I'm
still confused whether it is possible to preserve the running kernel as
"kernel-dcr" by copying the existing kernel files to the new name *without*
first modifying the kernel-package and then installing the modified package.

	I guess what I don't know is whether simply copying the existing files in the
manner set out below will screw up any hard-coded links to the old kernel file
names. (like any links in the copied System.map26-dcr that still point to the
original System.map26, etc..) So do you know if it is possible to preserve the
existing kernel on the system as kernel (-dcr), by doing something like:

1.  cp -a /usr/src/linux-2.6.36-ARCH /usr/src/linux-2.6.36-dcr

2.  cp -a /lib/modules/2.6.36-ARCH /lib/modules/2.6.36-dcr

3.  cp /boot/System.map26 /boot/System.map26-dcr

4.  cp /boot/vmlinuz26 /boot/vmlinuz26-dcr

5.  remake the initramfs

mkinitcpio -k 2.6.36-dcr \
-c /etc/mkinitcpio.conf \
-g /boot/kernel26-dcr.img

mkinitcpio -k 2.6.36-dcr \
-c /etc/mkinitcpio.conf \
-g /boot/kernel26-dcr-fallback.img \
-S autodetect

6.  update grub menu.lst and create entries for the dcr kernel

	I will definitely use your script to remake the existing kernel package into a
custom -dcr package and give that a try. The script was great at helping me
along in this process. (I still need to unravel all the bsdtar options). Also, I
tweaked the top part of the script to make it a bit more generic and to provide
a bit of usage information on error. If you like, here are a few bits you could
incorporate:

#!/bin/bash

E_NO_P_1=1
E_INV_PKG=2

# simple usage function to provide usage and error information
Usage() {
  [[ -n $1 ]] && echo -e "\n  ERROR: ${1}"
  echo -e "\n    Usage:   ${0##*/}  krnl-pkg_name [krnl-extension (default:
CSTM)]\n"
  echo -e "  The script repackages 'krnl-pkg_name' from its default name of
kernel26 to"
  echo -e "  kernel26-'krnl-extension' (default: kernel26-CSTM). The script will
rename"
  echo -e "  the source directory and module tree accordingly.\n"
  # test that $2 exists and is an interger and if so use as exit code
  [[ -n $2 ]] && [[ $2 -eq $2 ]] &>/dev/null && exit $2
  exit 1
}

[[ -z $1 ]] && Usage "Invalid Input - Arch Linux kernel package name required"
$E_NO_P_1
[[ $1 =~ pkg.tar ]] || Usage "Invalid Input - 'krnl-pkg_name' must be an Arch
Linux kernel package" $E_INV_PKG

NAME=${2:-CSTM}  # I just used parameter substitution instead of 2 tests
[[ ${NAME:0:1} != - ]] && NAME="-$NAME"  # if no - add it and not exit

# just temp test output to make sure it does what you want
echo -e "\n   \$1: $1"
echo -e "   \$2: $2"
echo -e " Name: $NAME\n"

	Thanks for your help.

-- 
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com


More information about the arch-general mailing list