Compare commits

..
8 Commits
Author SHA1 Message Date
Claudio Matsuoka 08d0dc6ee9 Disable debug
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-23 08:50:19 -03:00
Claudio Matsuoka 6e2ea43e97 Changelog updated
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-22 20:19:50 -03:00
Claudio Matsuoka 2679c1b1c5 Mount /var/lock and /var/run as tmpfs
Also create /var/run/console/<user> for X authentication

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-22 18:02:45 -03:00
Claudio Matsuoka d05900368f Fix string termination in path creation
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-22 18:00:48 -03:00
Claudio Matsuoka a1de36c163 Add note about default user in documentation
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-21 19:20:31 -03:00
Claudio Matsuoka 8206803762 Remove duplicate unionctl() error in initial reimplementation
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-21 14:09:32 -03:00
Claudio Matsuoka fb8c341168 Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
Metalshark says:
February 19th, 2008 at 9:10 pm

There is an issue with some ACPI/Kernel combinations to do with shutdown.

It isn’t always powering off (tried /proc/acpi and /sys methods) - however
removing all the fd > 5 stuff and putting in the simple line
“reboot(RB_POWER_OFF);” worked for all thus far. Although semantically
incorrect it is a working solution.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-21 09:43:35 -03:00
Claudio Matsuoka 7137573534 Post-0.2 adjustments
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-19 20:24:33 -03:00
7 changed files with 29 additions and 25 deletions
+6 -1
View File
@@ -1,5 +1,10 @@
0.3 ()
- Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
- Remove duplicate unionctl() reimplementation error
- Fix string termination in path creation
- Mount /var/lock and /var/run as tmpfs
0.2 ()
0.2 (20080219)
- replace system("touch") with touch() in finit-mod (Metalshark)
- disable NO_HCTOSYS by default to match stock Eeepc kernel
- drop system("rm -f") to clean /tmp, its a fresh mounted tmpfs
+4 -3
View File
@@ -3,9 +3,10 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
LD = gcc
LDFLAGS =
LIBS =
VERSION = 0.2
VERSION = 0.3
PKG = finit-$(VERSION)
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h
BINS = finit finit-mod finit-mdv
#### Configurable parameters
@@ -31,7 +32,7 @@ CFLAGS += -march=pentium-m
.c.o:
$(CC) -c $(CFLAGS) -o $*.o $<
all: finit finit-mod finit-mdv
all: $(BINS)
finit: finit.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
@@ -49,7 +50,7 @@ finit-mdv.o: finit-alt.c Makefile
$(CC) -c $(CFLAGS) -DDIST_MDV -o $@ finit-alt.c
clean:
rm -f *.o core *~
rm -f *.o core *~ $(BINS)
finit.o: finit.c Makefile
+2
View File
@@ -73,3 +73,5 @@ problems related to udev and pam.
4 - Set the pointer device in the X server configuration to /dev/input/mice
5 - Have a user named "user", or change DEFUSER in the source file
+10 -11
View File
@@ -171,6 +171,8 @@ int main()
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
mount("tmpfs", "/var/run", "tmpfs", 0, "mode=0755");
mount("tmpfs", "/var/lock", "tmpfs", 0, "mode=1777");
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
unlink("/etc/mtab");
@@ -251,13 +253,17 @@ int main()
unlink(RANDOMSEED);
umask(077);
copyfile("/dev/urandom", RANDOMSEED, 4096);
umask(0);
/*
* Console setup (for X)
*/
makepath("/var/run/console");
touch("/var/run/console/" DEFUSER);
/*
* Misc setup
*/
unlink("/var/run/.clean");
unlink("/var/lock/.clean");
umask(0);
mkdir("/tmp/.X11-unix", 01777);
mkdir("/tmp/.ICE-unix", 01777);
umask(022);
@@ -328,8 +334,6 @@ int main()
*/
void shutdown(int sig)
{
int fd;
debug("shutdown");
touch("/tmp/shutdown");
@@ -341,23 +345,18 @@ void shutdown(int sig)
system("/usr/sbin/alsactl store > /dev/null 2>&1");
system("/sbin/hwclock --systohc --localtime" HWCLOCK_DIRECTISA);
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
kill(-1, SIGKILL);
sync();
sync();
system("/bin/mount -n -o remount,ro /");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
if (sig == SIGINT || sig == SIGUSR1)
reboot(RB_AUTOBOOT);
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
write(fd, "5", 1);
close(fd);
}
reboot(RB_POWER_OFF);
}
+6 -8
View File
@@ -38,6 +38,9 @@ Changelog from the original Eeepc fastinit:
- Set loopback interface using direct calls instead of system("ifconfig")
- Copy 4096 data block in C instead of system("cat") or system("dd")
- Draw shutdown splash screen using C calls instead of system("echo;cat")
- Change poweroff method from writing 5 to /sys/power/state to
reboot(RB_POWER_OFF) (by Metalshark)
- Mount /var/run and /var/lock as tmpfs
*/
@@ -149,6 +152,8 @@ int main()
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
mount("tmpfs", "/var/run", "tmpfs", 0, "mode=0755");
mount("tmpfs", "/var/lock", "tmpfs", 0, "mode=1777");
mount("/mnt", "/", NULL, MS_MOVE, NULL);
/*
@@ -271,8 +276,6 @@ int main()
*/
void shutdown(int sig)
{
int fd;
touch("/tmp/shutdown");
kill(-1, SIGTERM);
@@ -283,23 +286,18 @@ void shutdown(int sig)
system("/usr/sbin/alsactl store > /dev/null 2>&1");
system("/sbin/hwclock --systohc --localtime" HWCLOCK_DIRECTISA);
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
kill(-1, SIGKILL);
sync();
sync();
system("/bin/mount -n -o remount,ro /");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
if (sig == SIGINT || sig == SIGUSR1)
reboot(RB_AUTOBOOT);
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
write(fd, "5", 1);
close(fd);
}
reboot(RB_POWER_OFF);
}
-2
View File
@@ -240,14 +240,12 @@ void shutdown(int sig)
system("/usr/sbin/alsactl store > /dev/null 2>&1");
system("/sbin/hwclock --systohc --localtime");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
kill(-1, SIGKILL);
sync();
sync();
system("/bin/mount -n -o remount,ro /");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
if (sig == SIGINT || sig == SIGUSR1)
+1
View File
@@ -25,6 +25,7 @@ int makepath(char *p)
do {
do { *x++ = *p++; } while (*p && *p != '/');
*x = 0;
ret = mkdir(path, 0777);
} while (*p && (*p != '/' || *(p + 1))); /* ignore trailing slash */