Skip to content

Commit 4d8c807

Browse files
committed
Support booting the rootfs from the system partition
1 parent 00b5d85 commit 4d8c807

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

init-script

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ echo "Running Mer Boat Loader"
2727
BOOTLOGO=%BOOTLOGO%
2828
ALWAYSDEBUG=%ALWAYSDEBUG%
2929
DATA_PARTITION=%DATA_PART%
30+
SYSTEM_PARTITION=$(findfs LABEL="system")
3031
DEFAULT_OS=%DEFAULT_OS%
3132

3233
set_welcome_msg(){
@@ -141,14 +142,27 @@ mount_stowaways() {
141142
if [ ! -z $DATA_PARTITION ]; then
142143
data_subdir="$(get_opt data_subdir)"
143144

144-
mkdir /data
145-
mkdir /target
145+
mkdir /data
146+
mkdir /target
146147

147-
mount $DATA_PARTITION /data
148-
mount /data/rootfs.img /target
148+
mount $DATA_PARTITION /data
149149

150-
mkdir -p /target/data # in new fs
151-
mount --bind /data/${data_subdir} /target/data
150+
if [ -f /data/rootfs.img ]; then
151+
mount /data/rootfs.img /target
152+
else
153+
if [ ! -z $SYSTEM_PARTITION ]; then
154+
# Mount the system partition as root filesystem
155+
mount $SYSTEM_PARTITION /target
156+
157+
# Refuse to boot android if installed on system partition
158+
if [ -f /target/build.prop ]; then
159+
echo "Refusing to boot android, install a Halium compatible rootfs first!" >> /diagnosis.log
160+
fi
161+
fi
162+
fi
163+
164+
mkdir -p /target/data # in new fs
165+
mount --bind /data/${data_subdir} /target/data
152166
else
153167
echo "Failed to mount /target, device node '$DATA_PARTITION' not found!" >> /diagnosis.log
154168
fi

0 commit comments

Comments
 (0)