ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #05249
Re: No loop mount option
On 13 November 2013 21:16, Dmitrijs Ledkovs <xnox@xxxxxxxxxx> wrote:
> Dear all,
>
> I've raised a merge proposal below, to allow initramfs to mount system
> partition direct as an ubuntu rootfs.
> At the moment this is a fallback, as apart from the emulator, it's not
> possible to have a large enough system partition to hold ubuntu
> rootfs.
>
I've now refreshed/resolved conflicts on the
initramfs-tools-ubuntu-touch, it stays the same.
GPT partition tables support has been enabled on the
linux-goldfish/armhf kernels.
Therefore I've now updated build-emulator-sdcard.sh patch.
It now uses GPT on the sdcard.img, by default it will create UBUNTU
system partition and USERDATA partition with the copy of ./system.img.
And therefore will function as before.
If "-no-loop" is passed, it will not include ./system.img on the
USERDATA partition, and the patched initramfs will look & mount UBUNTU
system partition direct.
Next step would be to check if emulator can read abootimg /
kernel+initramfs off a partition on the sdcard and boot/reboot using
that instead of externally supplied kernel/initramfs, that way it
would be possible to enable system-image updates.
Since this is now using GPT & sdcard (mmc) discussion on the preferred
default partitioning layouts can begin.
Regards,
Dmitrijs.
From 7e81bcca703df81ee22a4c7ce82a9bf1b198e552 Mon Sep 17 00:00:00 2001
From: Dmitrijs Ledkovs <dmitrijs.ledkovs@xxxxxxxxxxxxx>
Date: Fri, 22 Nov 2013 16:35:52 +0000
Subject: [PATCH] Use GPT on the sdcard, and optionally allow for ubuntu rootfs
to be on a separate partition, instead of a loop mount.
Signed-off-by: Dmitrijs Ledkovs <dmitrijs.ledkovs@xxxxxxxxxxxxx>
---
tools/build-emulator-sdcard.sh | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/tools/build-emulator-sdcard.sh b/tools/build-emulator-sdcard.sh
index 5d3bd65..ec74dc6 100755
--- a/tools/build-emulator-sdcard.sh
+++ b/tools/build-emulator-sdcard.sh
@@ -25,15 +25,20 @@ fi
sudo umount $OUT/mnt || true
-dd if=/dev/zero of=$OUT/ubuntu-system.img bs=1 count=0 seek=3G
-mkfs.ext4 -F -L UBUNTU $OUT/ubuntu-system.img
+dd if=/dev/zero of=$OUT/sdcard.img bs=1 count=0 seek=8G
+parted -s -a opt $OUT/sdcard.img -- mklabel gpt mkpart primary 1 3Gb mkpart primary 3Gb -1
+sudo kpartx -d $OUT/sdcard.img
+loop_name=$(sudo kpartx -agv $OUT/sdcard.img | sed -n "s/.*\(loop.*\)p1.*/\1/p")
-dd if=/dev/zero of=$OUT/sdcard.img bs=1 count=0 seek=4G
-mkfs.ext4 -F -L USERDATA $OUT/sdcard.img
+part_ubuntu_system=/dev/mapper/${loop_name}p1
+part_userdata=/dev/mapper/${loop_name}p2
+
+mkfs.ext4 -L UBUNTU ${part_ubuntu_system}
+mkfs.ext4 -L USERDATA ${part_userdata}
mkdir -p $OUT/mnt
-sudo mount $OUT/ubuntu-system.img $OUT/mnt
+sudo mount ${part_ubuntu_system} $OUT/mnt
sudo tar --numeric-owner -xf $OUT/ubuntu-rootfs.tar.xz -C $OUT/mnt/
sudo mv $OUT/mnt/system $OUT/mnt/system-unpack
@@ -92,9 +97,10 @@ sudo cp $OUT/system.img $OUT/mnt/var/lib/lxc/android/system.img
sync
sudo umount $OUT/mnt
+sudo dd if=${part_ubuntu_system} of=$OUT/ubuntu-system.img
-sudo mount $OUT/sdcard.img $OUT/mnt
-sudo cp $OUT/ubuntu-system.img $OUT/mnt/system.img
+sudo mount ${part_userdata} $OUT/mnt
+[ "$1" = "-no-loop" ] || sudo cp $OUT/ubuntu-system.img $OUT/mnt/system.img
sudo touch $OUT/mnt/.writable_image
sync
sudo umount $OUT/mnt
--
1.8.4.3
References