summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh37
1 files changed, 34 insertions, 3 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index dade059c8f..713a83092b 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -256,9 +256,34 @@ fi
256umount /tgt_root 256umount /tgt_root
257umount /src_root 257umount /src_root
258 258
259echo "Looking for kernels to use as boot target.."
260# Find kernel to boot to
261# Give user options if multiple are found
262kernels="$(find /run/media/$1/ -type f \
263 -name bzImage* -o -name zImage* \
264 -o -name vmlinux* -o -name vmlinuz* \
265 -o -name fitImage* \
266 | sed s:.*/::)"
267if [ -n "$(echo $kernels)" ]; then
268 # only one kernel entry if no space
269 if [ -z "$(echo $kernels | grep " ")" ]; then
270 kernel=$kernels
271 echo "$kernel will be used as the boot target"
272 else
273 echo "Which kernel do we want to boot by default? The following kernels were found:"
274 echo $kernels
275 read answer
276 kernel=$answer
277 fi
278else
279 echo "No kernels found, exiting..."
280 exit 1
281fi
282
259# Handling of the target boot partition 283# Handling of the target boot partition
260mount $bootfs /boot 284mount $bootfs /boot
261echo "Preparing boot partition..." 285echo "Preparing boot partition..."
286
262if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then 287if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then
263 echo "Preparing custom grub2 menu..." 288 echo "Preparing custom grub2 menu..."
264 root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs}) 289 root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs})
@@ -268,7 +293,7 @@ if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then
268 cat >$GRUBCFG <<_EOF 293 cat >$GRUBCFG <<_EOF
269menuentry "Linux" { 294menuentry "Linux" {
270 search --no-floppy --fs-uuid $boot_uuid --set root 295 search --no-floppy --fs-uuid $boot_uuid --set root
271 linux /vmlinuz root=PARTUUID=$root_part_uuid $rootwait rw $5 $3 $4 quiet 296 linux /$kernel root=PARTUUID=$root_part_uuid $rootwait rw $5 $3 $4 quiet
272} 297}
273_EOF 298_EOF
274 chmod 0444 $GRUBCFG 299 chmod 0444 $GRUBCFG
@@ -282,10 +307,16 @@ if [ $grub_version -eq 0 ] ; then
282 echo "timeout 30" >> /boot/grub/menu.lst 307 echo "timeout 30" >> /boot/grub/menu.lst
283 echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst 308 echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst
284 echo "root (hd0,0)" >> /boot/grub/menu.lst 309 echo "root (hd0,0)" >> /boot/grub/menu.lst
285 echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst 310 echo "kernel /$kernel root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
286fi 311fi
287 312
288cp /run/media/$1/vmlinuz /boot/ 313# Copy kernel artifacts. To add more artifacts just add to types
314# For now just support kernel types already being used by something in OE-core
315for types in bzImage zImage vmlinux vmlinuz fitImage; do
316 for kernel in `find /run/media/$1/ -name $types*`; do
317 cp $kernel /boot
318 done
319done
289 320
290umount /boot 321umount /boot
291 322