summaryrefslogtreecommitdiff
path: root/rxinit.c
blob: e74c847255a167887e535d4f19a9a3987a555596 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Original version written by Test_User <hax@andrewyu.org>
 * This version was modified by Runxi Yu <https://runxiyu.org>
 * SPDX-License-Identifier: CC0-1.0
 */

#include <stdio.h>
#include <unistd.h>
#include <sys/mount.h>

int main(void)
{
	puts("rxinit");
	mount(0, "/", 0, MS_REMOUNT | MS_NOATIME | MS_NODEV,
	      "errors=remount-ro");
	mount("devtmpfs", "/dev", "devtmpfs", MS_NOSUID | MS_NOEXEC, 0);
	mount("sysfs", "/sys", "sysfs", MS_NOSUID | MS_NOEXEC | MS_NODEV, 0);
	mount("proc", "/proc", "proc", MS_NOSUID | MS_NOEXEC | MS_NODEV, 0);
	mount("devpts", "/dev/pts", "devpts", MS_NOSUID | MS_NOEXEC, 0);
	mount("tmpfs", "/tmp", "tmpfs", MS_NODEV, "size=4G");
	execl("/sbin/init", "init", (char *)0);
	return 0;
}