mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
Merge branch 'master' of cmatsuoka@helllabs.org:git/eeepc
Conflicts: Changelog finit-mod.c Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
O.4 ()
|
||||
- create /dev/initctl fifo in finit-alt (for reboot)
|
||||
- default username for finit-alt configurable in Makefile
|
||||
- create loopback device node in finit-alt (for squashfs)
|
||||
- add option to use built-in run-parts instead of /bin/run-parts
|
||||
<<<<<<< HEAD:Changelog
|
||||
- ignore signal instead of setting to an empty handler (Metalshark)
|
||||
- handle pam_console permissions in finit-alt for Mandriva
|
||||
=======
|
||||
- add services.sh example and nash-hotplug patch for Mandriva
|
||||
>>>>>>> a3ad99798e6ade97a981adf5b4376e758c97b894:Changelog
|
||||
|
||||
0.3 (20080223)
|
||||
- Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
|
||||
|
||||
@@ -5,7 +5,8 @@ LDFLAGS =
|
||||
LIBS =
|
||||
VERSION = 0.4-pre
|
||||
PKG = finit-$(VERSION)
|
||||
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h
|
||||
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
|
||||
patches/*patch contrib/services.sh*
|
||||
BINS = finit finit-mod finit-mdv
|
||||
|
||||
|
||||
@@ -13,33 +14,33 @@ BINS = finit finit-mod finit-mdv
|
||||
#### Configurable parameters
|
||||
|
||||
# Default user for finit-alt if not "user"
|
||||
#USER=fred
|
||||
#DEFUSER = fred
|
||||
|
||||
# Add -DDEBUG to build with debug messages, also drops to terminal after X
|
||||
#CFLAGS += -DDEBUG
|
||||
|
||||
# Parameters added by Metalshark
|
||||
|
||||
# Use -march=pentium-m to build for Eeepc
|
||||
CFLAGS += -march=pentium-m
|
||||
|
||||
# Omit the first /sbin/hwclock if CONFIG_RTC_HCTOSYS is enabled in the kernel
|
||||
|
||||
#CFLAGS += -DNO_HCTOSYS
|
||||
|
||||
# Append –directisa to /sbin/hwclock lines if the user has disabled
|
||||
# Append -directisa to /sbin/hwclock lines if the user has disabled
|
||||
# CONFIG_GENRTC and enabled CONFIG_RTC but not enabled CONFIG_HPET_TIMER
|
||||
# and CONFIG_HPET_RTC_IRQ.
|
||||
#CFLAGS += -DDIRECTISA
|
||||
|
||||
# Use built-in run-parts instead of /bin/run-parts
|
||||
#CFLAGS += BUILTIN_RUNPARTS
|
||||
CFLAGS += -DBUILTIN_RUNPARTS
|
||||
|
||||
ifneq ($(USER), "user")
|
||||
CFLAGS += -DDEFUSER=\"$(USER)\"
|
||||
#### End of configurable parameters
|
||||
|
||||
|
||||
|
||||
ifneq ($(DEFUSER),)
|
||||
CFLAGS += -DDEFUSER=\"$(DEFUSER)\"
|
||||
endif
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) -o $*.o $<
|
||||
|
||||
@@ -67,10 +68,13 @@ finit.o: finit.c Makefile
|
||||
|
||||
finit-mod.o: finit-mod.c Makefile
|
||||
|
||||
helpers.o: helpers.c Makefile
|
||||
|
||||
dist:
|
||||
rm -Rf $(PKG)
|
||||
mkdir -p $(PKG)/contrib
|
||||
cp Makefile $(DFILES) $(PKG)
|
||||
mkdir -p $(PKG)/contrib $(PKG)/patches
|
||||
for i in $(DFILES); do cp $$i $(PKG)/`dirname $$i`; done
|
||||
tar cf - $(PKG) | gzip -c > $(PKG).tar.gz
|
||||
rm -Rf $(PKG)
|
||||
ls -l $(PKG).tar.gz
|
||||
|
||||
|
||||
@@ -4,13 +4,14 @@ Eeepc "fastinit" reimplementations
|
||||
|
||||
finit.c is a reimplementation of the Asus Eeepc fastinit program based
|
||||
on its library calls. It tries to be an accurate re-creation and keeps
|
||||
the original bugs and lack of optimization.
|
||||
the original bugs and unoptimized calls.
|
||||
|
||||
finit-mod.c is a fixed/improved version of finit.c.
|
||||
finit-mod.c is a fixed/improved version of finit.c intended to be a drop-in
|
||||
replacement for the original Eeepc OS.
|
||||
|
||||
finit-alt.c is a fixed/improved version of finit.c for alternative Linux
|
||||
distributions running on the Eeepc (previously ffinit.c). Currently able
|
||||
to boot unmodified Mandriva Linux.
|
||||
distributions running on the Eeepc (previously ffinit.c). It's currently
|
||||
able to boot Mandriva Linux 2008.0/2008.1.
|
||||
|
||||
See Makefile for configurable parameters to better suit your system.
|
||||
|
||||
@@ -49,34 +50,6 @@ umount vi
|
||||
console fb null ram0 sda1 sda2 sda3 sr0 tty0
|
||||
|
||||
|
||||
|
||||
Using finit with alternative systems
|
||||
------------------------------------
|
||||
|
||||
Currently tested only with Mandriva 2008. Proceed with caution, there are
|
||||
problems related to udev and pam.
|
||||
|
||||
1 - Add init=/sbin/finit-mdv to the kernel boot line
|
||||
|
||||
2 - Provide a suitable /usr/sbin/services.sh, this is the one I use in my
|
||||
test system:
|
||||
|
||||
mkdir /var/lock/subsys
|
||||
chmod 1777 /var/lock/subsys
|
||||
/etc/init.d/network start
|
||||
dhclient eth0
|
||||
/sbin/start_udev&
|
||||
/etc/init.d/portmap start
|
||||
/etc/init.d/nfs-common start
|
||||
|
||||
3 - Provide /etc/hostname if you don't have it already
|
||||
|
||||
4 - Set the pointer device in the X server configuration to /dev/input/mice
|
||||
|
||||
5 - Have a user named "user", or change the default in Makefile
|
||||
|
||||
|
||||
|
||||
Reboot and poweroff
|
||||
-------------------
|
||||
|
||||
@@ -84,3 +57,12 @@ Stock reboot and poweroff utilities of a modern Linux distribution may not
|
||||
work correctly with finit. You can replace them with simple scripts that
|
||||
send SIGUSR1 to finit for reboot, SIGUSR2 for poweroff.
|
||||
|
||||
|
||||
Using finit with KDE
|
||||
--------------------
|
||||
|
||||
If you use finit to start KDE with auto-login enabled, hal-based device
|
||||
automounting may not work correctly. That happens because the session
|
||||
is started before the system message bus, so add a "dcop kded mediamanager
|
||||
reloadBackends" call in the user AutoStart to restart the client.
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
Mandriva 2008
|
||||
-------------
|
||||
|
||||
1 - Add init=/sbin/finit-mdv to the kernel boot line
|
||||
|
||||
2 - Provide a suitable /usr/sbin/services.sh, this is the one I use in my
|
||||
test system running e17:
|
||||
|
||||
mkdir /var/lock/subsys
|
||||
chmod 1777 /var/lock/subsys
|
||||
/etc/init.d/network start
|
||||
dhclient eth0
|
||||
/sbin/start_udev&
|
||||
/etc/init.d/portmap start
|
||||
/etc/init.d/nfs-common start
|
||||
|
||||
If you use KDE or need more services, see examples in contrib/
|
||||
|
||||
3 - Provide /etc/hostname if you don't have it already
|
||||
|
||||
4 - Set the pointer device in the X server configuration to /dev/input/mice
|
||||
|
||||
5 - Have a user named "user", or change the default in Makefile
|
||||
|
||||
6 - Add the default user to group audio to be able to use sound (permissions
|
||||
are not changed using pam)
|
||||
|
||||
|
||||
|
||||
Mandriva 2008.1
|
||||
---------------
|
||||
|
||||
If you have a stuck nash-hotplug consuming 100% of CPU after the boot, you
|
||||
may want to patch mkinitrd using patches/mkinitrd-6.0.34-nash-hotplug.patch
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Example /usr/sbin/services.sh that can be used in a Mandriva 2008 system
|
||||
# running KDE
|
||||
|
||||
mkdir /var/lock/subsys
|
||||
chmod 1777 /var/lock/subsys
|
||||
/sbin/start_udev
|
||||
mkdir /var/run/dbus
|
||||
/etc/init.d/messagebus start
|
||||
/etc/init.d/haldaemon start
|
||||
/etc/init.d/alsa start
|
||||
/etc/init.d/sound start
|
||||
/etc/init.d/crond start
|
||||
/etc/init.d/network-up start
|
||||
/etc/init.d/network start
|
||||
/etc/init.d/syslog start
|
||||
kbuildsycoca --noincremental
|
||||
+14
-12
@@ -91,6 +91,7 @@ THE SOFTWARE.
|
||||
#define chardev(x,m,maj,min) mknod((x), S_IFCHR|(m), makedev((maj),(min)))
|
||||
#define blkdev(x,m,maj,min) mknod((x), S_IFBLK|(m), makedev((maj),(min)))
|
||||
|
||||
#define LINE_SIZE 1024
|
||||
|
||||
void shutdown(int);
|
||||
void signal_handler(int);
|
||||
@@ -101,13 +102,11 @@ int main()
|
||||
{
|
||||
int i;
|
||||
FILE *f;
|
||||
char line[2096];
|
||||
char line[LINE_SIZE];
|
||||
int fd;
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
char filename[1024];
|
||||
struct sigaction sa, act;
|
||||
char hline[1024];
|
||||
char *x;
|
||||
sigset_t nmask, nmask2;
|
||||
|
||||
@@ -145,7 +144,7 @@ int main()
|
||||
* Parse kernel parameters
|
||||
*/
|
||||
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
||||
fgets(line, 2095, f);
|
||||
fgets(line, LINE_SIZE, f);
|
||||
if (strstr(line, "quiet")) {
|
||||
close(0);
|
||||
close(1);
|
||||
@@ -166,8 +165,10 @@ int main()
|
||||
#endif
|
||||
umask(0);
|
||||
|
||||
#ifdef MAKE_DEVICES
|
||||
mkdir("/dev/shm", 0755);
|
||||
mkdir("/dev/pts", 0755);
|
||||
#endif
|
||||
|
||||
mount("sysfs", "/sys", "sysfs", 0, NULL);
|
||||
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
|
||||
@@ -187,6 +188,7 @@ int main()
|
||||
chmod("/dev/null", 0667);
|
||||
chmod("/dev/mem", 0640);
|
||||
chardev("/dev/tty", 0666, 5, 0);
|
||||
chardev("/dev/tty3", 0666, 4, 3);
|
||||
chardev("/dev/input/mice", 0660, 13, 63);
|
||||
chardev("/dev/input/event0", 0660, 13, 64);
|
||||
chardev("/dev/agpgart", 0660, 10, 175);
|
||||
@@ -194,7 +196,7 @@ int main()
|
||||
#endif
|
||||
|
||||
unlink("/etc/mtab");
|
||||
system("mount -a"); /* must be after creation of /dev/loop0 */
|
||||
system("mount -a");
|
||||
|
||||
umask(0022);
|
||||
|
||||
@@ -219,9 +221,9 @@ int main()
|
||||
while ((d = readdir(dir)) != NULL) {
|
||||
if (isalnum(d->d_name[0]))
|
||||
continue;
|
||||
sprintf(filename, "/etc/resolvconf/run/interface/%s",
|
||||
d->d_name);
|
||||
unlink(filename);
|
||||
snprintf(line, LINE_SIZE,
|
||||
"/etc/resolvconf/run/interface/%s", d->d_name);
|
||||
unlink(line);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
@@ -243,11 +245,11 @@ int main()
|
||||
#endif
|
||||
|
||||
if ((f = fopen("/etc/hostname", "r")) != NULL) {
|
||||
fgets(hline, 1023, f);
|
||||
if ((x = strchr(hline, 0x0a)) != NULL)
|
||||
fgets(line, LINE_SIZE, f);
|
||||
if ((x = strchr(line, 0x0a)) != NULL)
|
||||
*x = 0;
|
||||
|
||||
sethostname(hline, strlen(hline));
|
||||
sethostname(line, strlen(line));
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
@@ -294,7 +296,7 @@ int main()
|
||||
close(1);
|
||||
close(0);
|
||||
|
||||
if (open("/dev/tty1", O_RDWR, 0))
|
||||
if (open("/dev/tty1", O_RDWR) != 0)
|
||||
exit(1);
|
||||
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
||||
+12
-11
@@ -42,6 +42,8 @@ Changelog from the original Eeepc fastinit:
|
||||
reboot(RB_POWER_OFF) (by Metalshark)
|
||||
- Mount /var/run and /var/lock as tmpfs
|
||||
- Use SIG_IGN instead of empty signal handler (by Metalshark)
|
||||
- Add built-in run-parts option to be used instead of system("run-parts")
|
||||
- Reuse cmdline buffer as hostname and filename buffers
|
||||
|
||||
*/
|
||||
|
||||
@@ -82,6 +84,7 @@ Changelog from the original Eeepc fastinit:
|
||||
|
||||
#define touch(x) mknod((x), S_IFREG|0644, 0)
|
||||
|
||||
#define LINE_SIZE 1024
|
||||
|
||||
void shutdown(int);
|
||||
void chld_handler(int);
|
||||
@@ -91,13 +94,11 @@ int main()
|
||||
{
|
||||
int i;
|
||||
FILE *f;
|
||||
char line[2096];
|
||||
char line[LINE_SIZE];
|
||||
int fd;
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
char filename[1024];
|
||||
struct sigaction sa, act;
|
||||
char hline[1024];
|
||||
char *x;
|
||||
sigset_t nmask, nmask2;
|
||||
|
||||
@@ -133,7 +134,7 @@ int main()
|
||||
* Parse kernel parameters
|
||||
*/
|
||||
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
||||
fgets(line, 2095, f);
|
||||
fgets(line, LINE_SIZE, f);
|
||||
if (strstr(line, "quiet")) {
|
||||
close(0);
|
||||
close(1);
|
||||
@@ -177,9 +178,9 @@ int main()
|
||||
while ((d = readdir(dir)) != NULL) {
|
||||
if (isalnum(d->d_name[0]))
|
||||
continue;
|
||||
sprintf(filename, "/etc/resolvconf/run/interface/%s",
|
||||
d->d_name);
|
||||
unlink(filename);
|
||||
snprintf(line, LINE_SIZE,
|
||||
"/etc/resolvconf/run/interface/%s", d->d_name);
|
||||
unlink(line);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
@@ -199,11 +200,11 @@ int main()
|
||||
touch("/etc/network/run/ifstate");
|
||||
|
||||
if ((f = fopen("/etc/hostname", "r")) != NULL) {
|
||||
fgets(hline, 1023, f);
|
||||
if ((x = strchr(hline, 0x0a)) != NULL)
|
||||
fgets(line, LINE_SIZE, f);
|
||||
if ((x = strchr(line, 0x0a)) != NULL)
|
||||
*x = 0;
|
||||
|
||||
sethostname(hline, strlen(hline));
|
||||
sethostname(line, strlen(line));
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
@@ -237,7 +238,7 @@ int main()
|
||||
close(1);
|
||||
close(0);
|
||||
|
||||
if (open("/dev/tty1", O_RDWR, 0))
|
||||
if (open("/dev/tty1", O_RDWR) != 0)
|
||||
exit(1);
|
||||
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
||||
@@ -117,24 +117,18 @@ int run_parts(char *dir, ...)
|
||||
char *args[NUM_ARGS];
|
||||
va_list ap;
|
||||
|
||||
if ((d = opendir(dir)) == NULL)
|
||||
return -1;
|
||||
|
||||
if (chdir(dir))
|
||||
return -1;
|
||||
|
||||
if ((d = opendir(dir)) == NULL)
|
||||
return -1;
|
||||
|
||||
va_start(ap, dir);
|
||||
while (argnum < NUM_ARGS && (args[argnum++] = va_arg(ap, char *)));
|
||||
va_end(ap);
|
||||
|
||||
while (1) {
|
||||
if ((e = readdir(d)) == NULL)
|
||||
break;
|
||||
|
||||
if (e->d_type == DT_REG) {
|
||||
if (stat(e->d_name, &st))
|
||||
continue;
|
||||
|
||||
while ((e = readdir(d))) {
|
||||
if (e->d_type == DT_REG && stat(e->d_name, &st) == 0) {
|
||||
if (st.st_mode & S_IXUSR) {
|
||||
ent[num++] = strdup(e->d_name);
|
||||
if (num >= NUM_SCRIPTS)
|
||||
@@ -143,6 +137,8 @@ int run_parts(char *dir, ...)
|
||||
}
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
|
||||
if (num == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
Prevent nash-hotplug to keep running after boot using 100% of cpu
|
||||
|
||||
diff -rud mkinitrd-6.0.34-orig/nash/hotplug.c mkinitrd-6.0.34/nash/hotplug.c
|
||||
--- mkinitrd-6.0.34-orig/nash/hotplug.c 2008-03-06 21:20:34.000000000 -0300
|
||||
+++ mkinitrd-6.0.34/nash/hotplug.c 2008-03-12 18:48:46.000000000 -0300
|
||||
@@ -547,7 +547,7 @@
|
||||
nashLogger(nc, NASH_ERROR, "parent exited without telling us\n");
|
||||
close(nc->hp_childfd);
|
||||
nc->hp_childfd = -1;
|
||||
- break;
|
||||
+ exit(1);
|
||||
}
|
||||
count += rc;
|
||||
}
|
||||
Reference in New Issue
Block a user