|
Lines 8-16
Link Here
|
| 8 |
} |
8 |
} |
| 9 |
|
9 |
|
| 10 |
image_path() { |
10 |
image_path() { |
| 11 |
local x= kver=$(uname -r) |
11 |
local x= kver=$(uname -r) karch=$(uname -m) |
| 12 |
for x in "${KNAME:-bzImage}" vmlinuz \ |
12 |
for x in "${KNAME:-bzImage}" vmlinuz \ |
| 13 |
bzImage-"${kver}" vmlinuz-"${kver}" ; do |
13 |
bzImage-"${kver}" vmlinuz-"${kver}" \ |
|
|
14 |
kernel-genkernel-"${karch}"-"${kver}" ; do |
| 15 |
if [ -e "${BOOTPART}/${x}" ] ; then |
| 16 |
echo "${BOOTPART}/${x}" |
| 17 |
return 0 |
| 18 |
fi |
| 19 |
done |
| 20 |
|
| 21 |
return 1 |
| 22 |
} |
| 23 |
|
| 24 |
initrd_path() { |
| 25 |
local x= kver=$(uname -r) karch=$(uname -m) |
| 26 |
for x in "${INITRD:-initrd}" \ |
| 27 |
"initrd.img-${kver}" "initrd-${kver}.img" \ |
| 28 |
"initrd-${kver}" "initramfs-${kver}.img" \ |
| 29 |
"initramfs-genkernel-${karch}-${kver}" ; do |
| 14 |
if [ -e "${BOOTPART}/${x}" ] ; then |
30 |
if [ -e "${BOOTPART}/${x}" ] ; then |
| 15 |
echo "${BOOTPART}/${x}" |
31 |
echo "${BOOTPART}/${x}" |
| 16 |
return 0 |
32 |
return 0 |
|
Lines 29-43
Link Here
|
| 29 |
fi |
45 |
fi |
| 30 |
|
46 |
|
| 31 |
BOOTPART="${BOOTPART:-/boot}" |
47 |
BOOTPART="${BOOTPART:-/boot}" |
| 32 |
local img="$(image_path)" mounted=false initrdopt= |
48 |
local img="$(image_path)" initrd="$(initrd_path)" mounted=false initrdopt= |
| 33 |
|
49 |
|
| 34 |
if [ -z "${img}" ] ; then |
50 |
if [ -z "${img}" ] || [ -z "${initrd}" ] ; then |
| 35 |
# If we cannot find our image, try mounting ${BOOTPART} |
51 |
# If we cannot find our image, try mounting ${BOOTPART} |
| 36 |
if ! grep -q " ${BOOTPART} " /proc/mounts ; then |
52 |
if ! grep -q " ${BOOTPART} " /proc/mounts ; then |
| 37 |
ebegin "Mounting ${BOOTPART}" |
53 |
ebegin "Mounting ${BOOTPART}" |
| 38 |
mount "${BOOTPART}" && mounted=true |
54 |
mount "${BOOTPART}" && mounted=true |
| 39 |
eend $? || return $? |
55 |
eend $? || return $? |
| 40 |
img="$(image_path)" |
56 |
img="$(image_path)" |
|
|
57 |
initrd="$(initrd_path)" |
| 41 |
fi |
58 |
fi |
| 42 |
fi |
59 |
fi |
| 43 |
|
60 |
|
|
Lines 55-66
Link Here
|
| 55 |
KPARAM="$(sed -e 's/ /\n/g' /proc/cmdline | grep -v -e "^root=" | tr '\n' ' ')" |
72 |
KPARAM="$(sed -e 's/ /\n/g' /proc/cmdline | grep -v -e "^root=" | tr '\n' ' ')" |
| 56 |
fi |
73 |
fi |
| 57 |
|
74 |
|
| 58 |
# Use the default initrd if it exists and none other given |
75 |
if [ -n "${initrd}" ] ; then |
| 59 |
if [ -z "${INITRD}" -a -e "${BOOTPART}"/initrd ] ; then |
76 |
einfo " initrd image ${initrd}" |
| 60 |
INITRD="${BOOTPART}/initrd" |
77 |
initrdopt="--initrd=${initrd}" |
| 61 |
fi |
|
|
| 62 |
if [ -e "${INITRD}" ] ; then |
| 63 |
initrdopt="--initrd=${INITRD}" |
| 64 |
fi |
78 |
fi |
| 65 |
|
79 |
|
| 66 |
kexec -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt} |
80 |
kexec -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt} |