diff options
author | California Sullivan <california.l.sullivan@intel.com> | 2018-02-28 18:15:13 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-03-06 06:35:42 -0800 |
commit | 8451fd7139c935c5c513d8c1ff319ae2e4521a36 (patch) | |
tree | e5360191d23ee0733af4a67025bbc8444dfffafc /meta/recipes-core | |
parent | 32925a582f1f415bc549cf7bd41cd043880795dd (diff) | |
download | poky-8451fd7139c935c5c513d8c1ff319ae2e4521a36.tar.gz |
init-install.sh: support multiple kernels and don't assume vmlinuz
Since kernels will not necessarily be installed as vmlinuz anymore,
don't assume that's its name for either the bootloader config or the
copy of the kernel.
Also, allow installing multiple kernels by searching for common kernel
names.
(From OE-Core rev: 5d66a4ce7f2595e75fe2af62c11ee957540ca067)
Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-install.sh | 37 |
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 | |||
256 | umount /tgt_root | 256 | umount /tgt_root |
257 | umount /src_root | 257 | umount /src_root |
258 | 258 | ||
259 | echo "Looking for kernels to use as boot target.." | ||
260 | # Find kernel to boot to | ||
261 | # Give user options if multiple are found | ||
262 | kernels="$(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:.*/::)" | ||
267 | if [ -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 | ||
278 | else | ||
279 | echo "No kernels found, exiting..." | ||
280 | exit 1 | ||
281 | fi | ||
282 | |||
259 | # Handling of the target boot partition | 283 | # Handling of the target boot partition |
260 | mount $bootfs /boot | 284 | mount $bootfs /boot |
261 | echo "Preparing boot partition..." | 285 | echo "Preparing boot partition..." |
286 | |||
262 | if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then | 287 | if [ -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 |
269 | menuentry "Linux" { | 294 | menuentry "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 |
286 | fi | 311 | fi |
287 | 312 | ||
288 | cp /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 | ||
315 | for 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 | ||
319 | done | ||
289 | 320 | ||
290 | umount /boot | 321 | umount /boot |
291 | 322 | ||