-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathceinit
executable file
·46 lines (38 loc) · 1.53 KB
/
ceinit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# This file is part of Celestial (https://github.com/OpenFogStack/celestial).
# Copyright (c) 2024 Tobias Pfandzelter, The OpenFogStack Team.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# see https://github.com/firecracker-microvm/firecracker/discussions/3061
# in addition to the base file system, here we mount our overlay
# overlay_root is a kernel parameter
# check that $overlay_root is set and /dev/$overlay_root exists
# if not, give an error
if [ -z "$overlay_root" ] ||
[ ! -e "/dev/$overlay_root" ] && [ ! -d "/dev/$overlay_root" ]; then
echo "FATAL: Overlay root given as $overlay_root but /dev/$overlay_root does not exist"
echo "Known devices:"
ls /dev
exit 1
fi
echo "Initializing overlay root /dev/$overlay_root"
/bin/mount -t ext4 "/dev/$overlay_root" /overlay
mkdir -p /overlay/root /overlay/work
/bin/mount \
-o noatime,lowerdir=/,upperdir=/overlay/root,workdir=/overlay/work \
-t overlay "overlayfs:/overlay/root" /mnt
pivot_root /mnt /mnt/rom
./sbin/fcinit
exec /sbin/init