Check-in [a1fd38efc8]
Overview
Comment:Minor QEMU init updates
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a1fd38efc8e1376f177808c2a19d33d253a7b495
User & Date: rkeene on 2020-06-28 04:38:46.191
Other Links: manifest | tags
Context
2020-06-28
18:22
Switch to EXT4, Cache on its own partition/fs and added procps-ng to QEMU image check-in: 353218f0f3 user: rkeene tags: trunk
04:38
Minor QEMU init updates check-in: a1fd38efc8 user: rkeene tags: trunk
02:49
Added QEMU ignores check-in: 789651b077 user: rkeene tags: trunk
Changes
44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58







-
+







	exit(EXIT_FAILURE);
}

int main(int argc, char **argv) {
	/*
	 * Remount root filesystem read-write
	 */
	mount("/dev/vda2", "/", "ext2", MS_REMOUNT, NULL);
	mount("/dev/vda2", "/", "ext4", MS_REMOUNT, NULL);

	/*
	 * Mount needed filesystems
	 */
	mkdir("/dev", 0755);
	mount("devtmpfs", "/dev", "devtmpfs", 0, NULL);

67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83
84


85
86
87
88
89
90
91
92
93
94
95
96
97











98
99
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113







+











+
+













+
+
+
+
+
+
+
+
+
+
+



	/*
	 * Setup networking
	 */
	run("/bin/init-networking", "init-networking", NULL);
	run("/bin/init-fuse", "init-fuse", NULL);

	mkdir("/etc", 0755);
	mkdir("/bin", 0755);
	mkdir("/lib", 0755);
	mkdir("/opt", 0755);
	mkdir("/opt/appfs", 0755);
	mkdir("/var", 0755);
	mkdir("/var/cache", 0755);
	mkdir("/var/cache/appfs", 0755);
	run("/bin/appfsd", "appfsd", "/var/cache/appfs", "/opt/appfs", NULL);

	symlink(".", "/usr");
	symlink("lib", "/lib64");

	symlink("/proc/self/mounts", "/etc/mtab");

	symlink("/opt/appfs/core.appfs.rkeene.org/bash/platform/latest/bin/bash", "/bin/bash");
	symlink("/opt/appfs/core.appfs.rkeene.org/coreutils/platform/latest/bin/env", "/bin/env");

	symlink("/bin/bash", "/bin/sh");

	setenv("PATH", "/bin:/opt/appfs/core.appfs.rkeene.org/coreutils/platform/latest/bin", 1);
	run("/bin/appfs-cache", "appfs-cache", "install", "-lib", "core.appfs.rkeene.org", "glibc", NULL);
	run("/bin/appfs-cache", "appfs-cache", "install", "core.appfs.rkeene.org", "coreutils", NULL);
	setenv("PATH", "/bin", 1);

	run("/bin/sh", "sh", NULL);

	/*
	 * Remount root filesystem read-only
	 */
	umount("/dev");
	umount("/tmp");
	umount("/proc");
	umount("/sys");
	umount("/opt/appfs");
	mount("/dev/vda2", "/", "ext4", MS_REMOUNT | MS_RDONLY, NULL);
	sync();

	return(0);
}