mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-10 12:47:30 +00:00
When trying to debug an issue on ARM64 it was reported that it was quite difficult to debug because of control codes on the console from the splash. For cloud image there is a chroot customization the drops 'quiet splash' but this is only applied to amd64. It hasn't made it into other architectures because they don't have grub by default in the chroot. However, when we get into binary hook for the uefi disk image and it's derivatives grub is installed and this includes architectures that were skipped in the chroot hook. This patch changes the cpc-fixes chroot hook to add a cloud-images grub config with basic overrides, including dropping the boot splash, for all architectures. For images that never get grub installed this addition is harmless and small while ensuring that the grub experience is consistent for images that have grub. The configuration of console devices as hard-coded remains arch specific.
80 lines
2.0 KiB
Bash
Executable File
80 lines
2.0 KiB
Bash
Executable File
#!/bin/bash -eux
|
|
case $ARCH in
|
|
ppc64el|powerpc)
|
|
;;
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process"
|
|
FS_LABEL="cloudimg-rootfs"
|
|
|
|
. config/binary
|
|
|
|
. config/functions
|
|
|
|
create_partitions() {
|
|
disk_image="$1"
|
|
sgdisk "${disk_image}" \
|
|
--zap-all
|
|
sgdisk "${disk_image}" \
|
|
--new=2::+8M \
|
|
--new=1:
|
|
sgdisk "${disk_image}" -t 2:4100
|
|
sgdisk "${disk_image}" \
|
|
--print
|
|
}
|
|
|
|
install_grub() {
|
|
mkdir mountpoint
|
|
mount_partition "${rootfs_dev_mapper}" mountpoint
|
|
|
|
chroot mountpoint apt-get -qqy update
|
|
chroot mountpoint apt-get -qqy install grub-ieee1275
|
|
chroot mountpoint apt-get -qqy remove --purge grub-legacy-ec2
|
|
|
|
# set the kernel commandline to use hvc0
|
|
CONSOLE="console=hvc0 earlyprintk"
|
|
# Append to the existing GRUB_CMDLINE_LINUX_DEFAULT line
|
|
if [ ! -f mountpoint/etc/default/grub.d/50-cloudimg-settings.cfg ]; then
|
|
echo "Expected to find an existing grub config override"
|
|
exit 1
|
|
fi
|
|
sed -e "/^\s*GRUB_CMDLINE_LINUX_DEFAULT=/{s/=\"\"/=\"$CONSOLES$itemNum\"/;t;s/\"$/ $CONSOLES$itemNum&/;}" \
|
|
mountpoint/etc/default/grub.d/50-cloudimg-settings.cfg
|
|
|
|
prep_partition="/dev/mapper${loop_device///dev/}p2"
|
|
chroot mountpoint grub-install "${prep_partition}" \
|
|
--no-nvram \
|
|
--boot-directory=/boot \
|
|
--target=powerpc-ieee1275
|
|
|
|
divert_grub mountpoint
|
|
chroot mountpoint update-grub
|
|
replace_grub_root_with_label mountpoint
|
|
undivert_grub mountpoint
|
|
|
|
umount_partition mountpoint
|
|
rmdir mountpoint
|
|
}
|
|
|
|
disk_image=binary/boot/disk.ext4
|
|
|
|
create_empty_disk_image "${disk_image}"
|
|
create_partitions "${disk_image}"
|
|
mount_image "${disk_image}" 1
|
|
|
|
# Copy the chroot in to the disk
|
|
make_ext4_partition "${rootfs_dev_mapper}"
|
|
mkdir mountpoint
|
|
mount "${rootfs_dev_mapper}" mountpoint
|
|
cp -a chroot/* mountpoint/
|
|
umount mountpoint
|
|
rmdir mountpoint
|
|
|
|
install_grub
|
|
|
|
clean_loops
|
|
trap - EXIT
|