Skip to content

Commit

Permalink
Try to support droid4-kexecboot
Browse files Browse the repository at this point in the history
This assumes SafeStrap installs will always have root=/dev/ram0.
When booting with droid4-kexecboot, there are two options:

* root= is omitted, data_partition= and system_partition= are used to
specify partitions to be used as /data and /system partitions. SailfishOS is
then mounted from /data/.stowaways/sailfishos as usual.

* root= is specified, pointing to partition with SailfishOS rootfs installed.
data_partition= and system_partition=  can be still used to mount /data and
/system for Droid HAL, otherwise rootfs needs to do it itself.

Change-Id: I5f3066834baf4bd001616c5fa0517d9bdf56c8c3
  • Loading branch information
NotKit committed Jan 13, 2018
1 parent 0267cc4 commit e03c369
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions init-script
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ bootsplash() {
fi
}


mount_stowaways() {
mount_safestrap() {
echo "########################## mounting safestrap"
# mount safestrap partition
mkdir /ss
Expand All @@ -163,6 +162,42 @@ mount_stowaways() {
SYSTEM_PARTITION=$(losetup -f)
losetup $SYSTEM_PARTITION /ss/safestrap/$SLOT_LOC/system.img
fi
}

mount_kexecboot() {
ROOT_PARTITION="$(get_opt root)"
DATA_PARTITION="$(get_opt data_partition)"
SYSTEM_PARTITION="$(get_opt system_partition)"

if [ ! -z $ROOT_PARTITION ]; then
echo "########################## mounting rootfs"
mkdir /target
mount $ROOT_PARTITION /target

if [ ! -z $DATA_PARTITION ]; then
echo "########################## mounting /data"
data_subdir="$(get_opt data_subdir)"

mkdir /data
mount $DATA_PARTITION /data
mkdir /target/data # in new fs
mount --bind /data/${data_subdir} /target/data
fi

if [ ! -z $SYSTEM_PARTITION ]; then
echo "########################## mounting /system"
mkdir /target/system
mount $SYSTEM_PARTITION -o ro /target/system
fi
elif [ ! -z $DATA_PARTITION ]; then
# No root specified, try to mount SailfishOS from /data/.stowaways as usual
mount_stowaways
else
echo "Failed to mount /target, neither root= or data_partition= are specified!" >> /diagnosis.log
fi
}

mount_stowaways() {
echo "########################## mounting stowaways"
if [ ! -z $DATA_PARTITION ]; then
data_subdir="$(get_opt data_subdir)"
Expand Down Expand Up @@ -352,7 +387,12 @@ if [ "$DONE_SWITCH" = "no" ]; then

bootsplash

mount_stowaways
if [ "$(get_opt root)" = "/dev/ram0" ] ; then
mount_safestrap
mount_stowaways
else
mount_kexecboot
fi

# No target debug unless we debug here too (for now)

Expand Down

0 comments on commit e03c369

Please sign in to comment.