Check-in [a1fd38efc8]
Overview
Comment:Minor QEMU init updates
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a1fd38efc8e1376f177808c2a19d33d253a7b495
User & Date: rkeene on 2020-06-28 04:38:46
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

Modified build/qemu/init.c from [67d154f314] to [c418f5267f].

    44     44   	exit(EXIT_FAILURE);
    45     45   }
    46     46   
    47     47   int main(int argc, char **argv) {
    48     48   	/*
    49     49   	 * Remount root filesystem read-write
    50     50   	 */
    51         -	mount("/dev/vda2", "/", "ext2", MS_REMOUNT, NULL);
           51  +	mount("/dev/vda2", "/", "ext4", MS_REMOUNT, NULL);
    52     52   
    53     53   	/*
    54     54   	 * Mount needed filesystems
    55     55   	 */
    56     56   	mkdir("/dev", 0755);
    57     57   	mount("devtmpfs", "/dev", "devtmpfs", 0, NULL);
    58     58   
................................................................................
    67     67   
    68     68   	/*
    69     69   	 * Setup networking
    70     70   	 */
    71     71   	run("/bin/init-networking", "init-networking", NULL);
    72     72   	run("/bin/init-fuse", "init-fuse", NULL);
    73     73   
           74  +	mkdir("/etc", 0755);
    74     75   	mkdir("/bin", 0755);
    75     76   	mkdir("/lib", 0755);
    76     77   	mkdir("/opt", 0755);
    77     78   	mkdir("/opt/appfs", 0755);
    78     79   	mkdir("/var", 0755);
    79     80   	mkdir("/var/cache", 0755);
    80     81   	mkdir("/var/cache/appfs", 0755);
    81     82   	run("/bin/appfsd", "appfsd", "/var/cache/appfs", "/opt/appfs", NULL);
    82     83   
    83     84   	symlink(".", "/usr");
    84     85   	symlink("lib", "/lib64");
           86  +
           87  +	symlink("/proc/self/mounts", "/etc/mtab");
    85     88   
    86     89   	symlink("/opt/appfs/core.appfs.rkeene.org/bash/platform/latest/bin/bash", "/bin/bash");
    87     90   	symlink("/opt/appfs/core.appfs.rkeene.org/coreutils/platform/latest/bin/env", "/bin/env");
    88     91   
    89     92   	symlink("/bin/bash", "/bin/sh");
    90     93   
    91     94   	setenv("PATH", "/bin:/opt/appfs/core.appfs.rkeene.org/coreutils/platform/latest/bin", 1);
    92     95   	run("/bin/appfs-cache", "appfs-cache", "install", "-lib", "core.appfs.rkeene.org", "glibc", NULL);
    93     96   	run("/bin/appfs-cache", "appfs-cache", "install", "core.appfs.rkeene.org", "coreutils", NULL);
    94     97   	setenv("PATH", "/bin", 1);
    95     98   
    96     99   	run("/bin/sh", "sh", NULL);
    97    100   
          101  +	/*
          102  +	 * Remount root filesystem read-only
          103  +	 */
          104  +	umount("/dev");
          105  +	umount("/tmp");
          106  +	umount("/proc");
          107  +	umount("/sys");
          108  +	umount("/opt/appfs");
          109  +	mount("/dev/vda2", "/", "ext4", MS_REMOUNT | MS_RDONLY, NULL);
          110  +	sync();
          111  +
    98    112   	return(0);
    99    113   }