File README changed (mode: 100644) (index 396fe3d..cad49c8) |
... |
... |
async scan is complete. You can remove it once done. |
5 |
5 |
|
|
6 |
6 |
This is a toolbox to build a combined initramfs and main init process. |
This is a toolbox to build a combined initramfs and main init process. |
7 |
7 |
During early user space, it loads the modules requiered to mount the root file |
During early user space, it loads the modules requiered to mount the root file |
8 |
|
system, then it runs a process of your choice which will init the system, to |
|
9 |
|
finally spawns some gettys on ttys, respawning them when they die. |
|
|
8 |
|
system, then it runs a process of your choice which will init the system (see |
|
9 |
|
examples in script dir), to finally spawns some gettys on ttys, respawning them |
|
10 |
|
when they die. |
10 |
11 |
|
|
11 |
12 |
coding style is c99 compact: |
coding style is c99 compact: |
12 |
13 |
- indent is 2 spaces |
- indent is 2 spaces |
File script/example_init.sh added (mode: 100755) (index 0000000..a9caab8) |
|
1 |
|
#!/bin/bash --login |
|
2 |
|
|
|
3 |
|
/bin/mount -o nosuid,nodev,noexec,relatime -t proc proc /proc |
|
4 |
|
/bin/mount -o nosuid,nodev,noexec,relatime -t sysfs sysfs /sys |
|
5 |
|
|
|
6 |
|
#------------------------------------------------------------------------------- |
|
7 |
|
#mount /dev |
|
8 |
|
/bin/mount -o exec,nosuid,relatime,size=10M,mode=0755 -t tmpfs udev /dev |
|
9 |
|
|
|
10 |
|
[ -c /dev/console ] || mknod -m 600 /dev/console c 5 1 |
|
11 |
|
[ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1 |
|
12 |
|
[ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0 |
|
13 |
|
|
|
14 |
|
#udevd will dup its stdin/stdout/stderr to /dev/null |
|
15 |
|
#and we do not want a file which gets buffered in ram |
|
16 |
|
[ -c /dev/null ] || mknod -m 666 /dev/null c 1 3 |
|
17 |
|
|
|
18 |
|
# so udev can add its start-message to dmesg |
|
19 |
|
[ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11 |
|
20 |
|
|
|
21 |
|
/bin/mkdir -m 0755 -p /dev/pts |
|
22 |
|
/bin/mount -o relatime,gid=5,mode=0620 -t devpts devpts /dev/pts |
|
23 |
|
|
|
24 |
|
#may be useless |
|
25 |
|
/bin/mkdir -m 1777 -p /dev/shm |
|
26 |
|
/bin/mount -o nosuid,nodev,noexec,relatime -t tmpfs shm /dev/shm |
|
27 |
|
#------------------------------------------------------------------------------- |
|
28 |
|
|
|
29 |
|
/bin/mount -o nosuid,nodev,relatime,mode=0755 -t tmpfs tmpfs /run |
|
30 |
|
/bin/rm -Rf /tmp/* |
|
31 |
|
/bin/hostname "freedom" |
|
32 |
|
|
|
33 |
|
#------------------------------------------------------------------------------- |
|
34 |
|
#udev |
|
35 |
|
/sbin/modprobe unix |
|
36 |
|
/bin/rm -Rf /run/udev |
|
37 |
|
echo "" >/sys/kernel/uevent_helper |
|
38 |
|
/sbin/udevd --daemon |
|
39 |
|
/sbin/udevadm trigger --type=subsystems --action=add |
|
40 |
|
/sbin/udevadm trigger --type=devices --action=add |
|
41 |
|
|
|
42 |
|
#those modules need /dev nodes |
|
43 |
|
/sbin/modprobe rtc-cmos |
|
44 |
|
/sbin/modprobe radeon |
|
45 |
|
/sbin/modprobe fbcon |
|
46 |
|
|
|
47 |
|
/sbin/udevadm settle |
|
48 |
|
#------------------------------------------------------------------------------- |
|
49 |
|
|
|
50 |
|
#------------------------------------------------------------------------------- |
|
51 |
|
#network |
|
52 |
|
/sbin/modprobe sch-dsmark |
|
53 |
|
/sbin/ip addr add 127.0.0.1/8 dev lo |
|
54 |
|
/sbin/ip addr add 192.168.1.2/24 dev eth0 |
|
55 |
|
#------------------------------------------------------------------------------- |
|
56 |
|
|
|
57 |
|
#------------------------------------------------------------------------------- |
|
58 |
|
#CPUs |
|
59 |
|
/sbin/modprobe -r microcode |
|
60 |
|
/sbin/modprobe microcode |
|
61 |
|
/sbin/modprobe powernow-k8 |
|
62 |
|
/usr/bin/cpufreq-set --related --governor ondemand |
|
63 |
|
#------------------------------------------------------------------------------- |
|
64 |
|
|
|
65 |
|
#------------------------------------------------------------------------------- |
|
66 |
|
/sbin/hwclock --utc --hctosys |
|
67 |
|
#------------------------------------------------------------------------------- |
|
68 |
|
|
|
69 |
|
/usr/sbin/alsactl restore |
|
70 |
|
|
|
71 |
|
#------------------------------------------------------------------------------- |
|
72 |
|
#block scheduler |
|
73 |
|
/sbin/modprobe cfq-iosched |
|
74 |
|
echo "cfq" > /sys/block/sda/queue/scheduler |
|
75 |
|
#------------------------------------------------------------------------------- |
|
76 |
|
|
|
77 |
|
/sbin/swapon -a |
|
78 |
|
/sbin/sysctl |
|
79 |
|
|
|
80 |
|
#------------------------------------------------------------------------------- |
|
81 |
|
#console terminal setup |
|
82 |
|
printf "\033%s" "%G" >/dev/tty1 |
|
83 |
|
/usr/bin/kbd_mode -u -C /dev/tty1 |
|
84 |
|
printf "\033%s" "%G" >/dev/tty2 |
|
85 |
|
/usr/bin/kbd_mode -u -C /dev/tty2 |
|
86 |
|
printf "\033%s" "%G" >/dev/tty3 |
|
87 |
|
/usr/bin/kbd_mode -u -C /dev/tty3 |
|
88 |
|
/usr/bin/loadkeys -q dvorak |
|
89 |
|
#------------------------------------------------------------------------------- |
|
90 |
|
|
|
91 |
|
#------------------------------------------------------------------------------- |
|
92 |
|
#utmp/wtmp |
|
93 |
|
: >/var/run/utmp |
|
94 |
|
/bin/chgrp utmp /var/run/utmp 2>/dev/null |
|
95 |
|
/bin/chmod 0664 /var/run/utmp |
|
96 |
|
if test ! -e /var/log/wtmp; then |
|
97 |
|
: >/var/log/wtmp |
|
98 |
|
/bin/chgrp utmp /var/log/wtmp 2>/dev/null |
|
99 |
|
/bin/chmod 0664 /var/log/wtmp |
|
100 |
|
fi |
|
101 |
|
#------------------------------------------------------------------------------- |
|
102 |
|
|
|
103 |
|
/usr/sbin/syslog-ng |
|
104 |
|
/usr/sbin/fcron |