2015-11-06 09:55:33 +00:00
|
|
|
#!/bin/bash -eux
|
2016-04-03 02:39:50 -06:00
|
|
|
case $ARCH in
|
|
|
|
ppc64el|powerpc)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
2015-11-06 09:55:33 +00:00
|
|
|
|
2017-04-12 19:37:08 -04:00
|
|
|
IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process"
|
|
|
|
FS_LABEL="cloudimg-rootfs"
|
|
|
|
|
2017-12-04 10:51:13 +13:00
|
|
|
. config/binary
|
|
|
|
|
2017-04-12 19:37:08 -04:00
|
|
|
. config/functions
|
2015-11-06 09:55:33 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2016-06-28 16:21:08 -07:00
|
|
|
chroot mountpoint apt-get -qqy update
|
2017-12-06 14:22:43 -08:00
|
|
|
chroot mountpoint apt-get -qqy install grub-ieee1275
|
2015-11-06 09:55:33 +00:00
|
|
|
chroot mountpoint apt-get -qqy remove --purge grub-legacy-ec2
|
|
|
|
|
|
|
|
# set the kernel commandline to use hvc0
|
|
|
|
mkdir -p mountpoint/etc/default/grub.d
|
|
|
|
cat << EOF > mountpoint/etc/default/grub.d/50-cloudimg-settings.cfg
|
2017-04-12 19:37:08 -04:00
|
|
|
${IMAGE_STR}
|
2016-01-28 11:51:23 +00:00
|
|
|
|
|
|
|
# Set the recordfail timeout
|
|
|
|
GRUB_RECORDFAIL_TIMEOUT=0
|
|
|
|
|
|
|
|
# Do not wait on grub prompt
|
|
|
|
GRUB_TIMEOUT=0
|
|
|
|
|
2015-11-06 09:55:33 +00:00
|
|
|
# Set the default commandline
|
2016-04-14 14:47:42 -04:00
|
|
|
GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 earlyprintk"
|
2015-11-06 09:55:33 +00:00
|
|
|
EOF
|
|
|
|
prep_partition="/dev/mapper${loop_device///dev/}p2"
|
|
|
|
chroot mountpoint grub-install "${prep_partition}" \
|
|
|
|
--no-nvram \
|
|
|
|
--boot-directory=/boot \
|
|
|
|
--target=powerpc-ieee1275
|
|
|
|
|
2017-10-04 23:02:36 -07:00
|
|
|
divert_grub mountpoint
|
2016-01-27 16:32:58 +00:00
|
|
|
chroot mountpoint update-grub
|
2017-03-23 11:39:22 -06:00
|
|
|
replace_grub_root_with_label mountpoint
|
2017-10-04 23:02:36 -07:00
|
|
|
undivert_grub mountpoint
|
2016-01-27 16:32:58 +00:00
|
|
|
|
2015-11-06 09:55:33 +00:00
|
|
|
umount_partition mountpoint
|
|
|
|
rmdir mountpoint
|
|
|
|
}
|
|
|
|
|
|
|
|
disk_image=binary/boot/disk.ext4
|
|
|
|
|
|
|
|
create_empty_disk_image "${disk_image}"
|
|
|
|
create_partitions "${disk_image}"
|
Import patches-unapplied version 2.376 to ubuntu/xenial-proposed
Imported using git-ubuntu import.
Changelog parent: 80fddc56a2b4d6ed82dcce3ef56028b37e40705a
New changelog entries:
[ Michael Terry ]
* Change real name for phablet user to "Ubuntu" in ubuntu-touch.
[ Steve Langasek ]
* Drop BuildLiveCD from the examples; we now use launchpad-buildd to drive
livefs builds, so BuildLiveCD is obsolete and misleading.
* Add hooks to ubuntu-cpc to divert /bin/sync in the chroot and undivert it
at the end. This is a general-purpose change that should be applied to
all flavors and archs, but at the moment it's only needed on armhf+raspi2
to work around the raspberrypi2-firmware postinst calling sync, which is
actually warranted in the normal case.
* If a subarch is specified for a cloud image build, don't build rootfs
artifacts; these should come from the 'generic' build.
* Fix architecture handling in hooks. We know we're always being invoked
from a launchpad-buildd-like setup, which passes ARCH and SUBARCH in the
environment, because auto/config and auto/build both rely on this. So
don't scatter dpkg --print-architecture calls throughout, especially
when many of these are not cross-build-aware.
* Refactor ubuntu-cpc hooks to allow us to handle images where the root
partition should not be partition 1.
[ Ben Howard ]
* ubuntu-cpc: fix hooks/032-disk-image.binary call to
create_empty_partition, which requires five args due to "-u"
* ubuntu-cpc: in hooks/030-root-tarball.binary create /lib/modules to fix
(LP: 1543204).
[ Dimitri John Ledkov ]
* Do not remove linux-base, when purging all the linux-*, in the tarball
build. Otherwise ubuntu-minimal is removed, and things get crazy.
* Correct initrd.img symlink, kernel/hooks should actually produce the
right thing here, but meh.
* Chroot to execute zipl, because it's nice.
* Use the right loop device to install zipl onto.
[ Steve Langasek ]
* Refactor ubuntu-cpc hooks to always produce a 'plain' rootfs via
live-build and reuse this for the tarball, instead of lb_binary_rootfs
creating some artifact that we ignore / throw away.
* Initial support for raspi2 subarch.
* Import live-build/ubuntu-cpc/hooks/raspi2/mkknlimg from
https://github.com/raspberrypi/linux/blob/rpi-4.1.y/scripts/mkknlimg
and use it to install a bootable uboot.bin.
2016-02-12 21:14:49 +00:00
|
|
|
mount_image "${disk_image}" 1
|
2015-11-06 09:55:33 +00:00
|
|
|
|
|
|
|
# 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
|