Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-initrd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ done
[ -z $OUT ] && OUT=./out

# list all packages needed for halium's initrd here
[ -z $INCHROOTPKGS ] && INCHROOTPKGS="initramfs-tools dctrl-tools dmsetup e2fsprogs libc6-dev zlib1g-dev libssl-dev busybox-static parse-android-dynparts"
[ -z $INCHROOTPKGS ] && INCHROOTPKGS="initramfs-tools dctrl-tools dmsetup e2fsprogs libc6-dev lvm2 zlib1g-dev libssl-dev busybox-static parse-android-dynparts"

BOOTSTRAP_BIN="qemu-debootstrap --arch $ARCH --variant=minbase"

Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Depends: initramfs-tools,
coreutils,
busybox-static,
e2fsprogs,
lvm2,
${misc:Depends}
Description: tools for mounting an Ubuntu Touch rootfs
This package contains the scripts to boot an Ubuntu Touch device.
Expand Down
2 changes: 1 addition & 1 deletion debian/initramfs-tools-halium.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
apply_diversions() {
DIR=/usr/share/initramfs-tools
SUBDIRS="hooks scripts/local-premount scripts/init-top scripts/init-bottom scripts/panic"
FILES="compcache fixrtc dmsetup plymouth console_setup kbd thermal"
FILES="compcache fixrtc plymouth console_setup kbd thermal"

for file in $FILES; do
for subdir in $SUBDIRS; do
Expand Down
3 changes: 2 additions & 1 deletion hooks/halium
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh -e

MINKVER="2.6.24"
PREREQ=""
PREREQ="lvm2"
DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)

# Output pre-requisites
Expand All @@ -26,6 +26,7 @@ copy_exec /bin/chown /bin
copy_exec /bin/mount /bin
copy_exec /sbin/dmsetup /sbin
copy_exec /sbin/dumpe2fs /sbin
copy_exec /sbin/lvm /sbin
copy_exec /lib/$DEB_HOST_MULTIARCH/libz.so.1
copy_exec /usr/lib/$DEB_HOST_MULTIARCH/libcrypto.so
copy_exec /usr/lib/$DEB_HOST_MULTIARCH/libdl.so
Expand Down
66 changes: 45 additions & 21 deletions scripts/halium
Original file line number Diff line number Diff line change
Expand Up @@ -430,36 +430,50 @@ mountroot() {
# Make sure the device has been created by udev before we try to mount
udevadm settle

# find the right partition
for partname in $partlist; do
part=$(find /dev -name $partname | tail -1)
[ -z "$part" ] && continue
path=$(readlink -f $part)
[ -n "$path" ] && break
# Check for LVM volume group in kernel cmdline and activate LVM
vg=""
for x in $(cat /proc/cmdline); do
case ${x} in
halium_lvm_vg=*)
vg=${x#*=}
;;
esac
done

# On systems with A/B partition layout, current slot is provided via cmdline parameter.
ab_slot_suffix=$(grep -o 'androidboot\.slot_suffix=..' /proc/cmdline | tail -1 | cut -d "=" -f2)
if [ -z "$path" ] && [ ! -z "$ab_slot_suffix" ] ; then
tell_kmsg "Searching for A/B data partition on slot $ab_slot_suffix."
# Use partitions from LVM volume group if present
if [ -n "$vg" ]; then
# Check if the volume group actually exists
if lvm vgs "$vg" >/dev/null 2>&1; then
tell_kmsg "Volume group $vg found"
else
tell_kmsg "WARNING: Volume group $vg specified but not found"
vg=""
fi
fi

# First check if LVM volume group has userdata
if [ -n "$vg" ] && [ -e "/dev/$vg/userdata" ]; then
tell_kmsg "Using LVM userdata volume at /dev/$vg/userdata"
path="/dev/$vg/userdata"
else
# Find the right partition for userdata
for partname in $partlist; do
part=$(find /dev -name "$partname$ab_slot_suffix" | tail -1)
part=$(find /dev -name $partname | tail -1)
[ -z "$part" ] && continue
path=$(readlink -f $part)
[ -n "$path" ] && break
done
fi

# override with a possible cmdline parameter
if grep -q datapart= /proc/cmdline; then
for x in $(cat /proc/cmdline); do
case ${x} in
datapart=*)
path=${x#*=}
;;
esac
done
# Override with a possible cmdline parameter
if grep -q datapart= /proc/cmdline; then
for x in $(cat /proc/cmdline); do
case ${x} in
datapart=*)
path=${x#*=}
;;
esac
done
fi
fi

if [ -z "$path" ]; then
Expand Down Expand Up @@ -517,6 +531,16 @@ mountroot() {
fi
fi

# Override systempart with LVM rootfs if volume group is provided
if [ -n "$vg" ] && [ -e "/dev/$vg/rootfs" ]; then
tell_kmsg "Overriding systempart with LVM rootfs at /dev/$vg/rootfs"
_syspart="/dev/$vg/rootfs"
# Keep existing options if they were set, otherwise use rw
if [ -z "$_syspart_options" ]; then
_syspart_options=rw
fi
fi

# We need to add the slot suffix to $_syspart for A/B devices
if [ -n "$_syspart" ] && [ ! -e "$_syspart" ] && [ ! -z "$ab_slot_suffix" ]; then
tell_kmsg "A/B slot system detected! Slot suffix is $ab_slot_suffix"
Expand Down