On Tue, Jun 08, H. Peter Anvin wrote:
> OK, I have just pushed out klibc-0.130; it significantly updates the
> run-init program (again... PLEASE TEST IN A SAFE ENVIRONMENT) based on, but
> not identical to, Alexander's suggestions; it also adds s390/x patches
from
> Arnd Bergmann.
Hmm, havent looked at the code, but your mails sound like the
implementation is a bit messy.
I'm attaching what we ship with suse 9.1. Some corner cases still need
fixing.
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n?RNBERG
-------------- next part --------------
/* $Id: udev.run_init.c 136 2004-04-17 14:08:22Z olh $ */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mount.h>
#ifndef MS_MOVE
#warning MS_MOVE was not defined...
#define MS_MOVE 8192
#endif
static char final_init[] = "INIT";
int
main(int argc, char *argv[], char *envp[])
{
char *init;
if (getpid() != 1) {
fprintf(stderr, "%s must be started from initramfs\n", argv[0]);
goto good_bye;
}
init = getenv(final_init);
if (!init) {
init = "/sbin/init";
fprintf(stderr, " %s not set, trying %s ... \n",
final_init, init);
}
unlink(argv[0]);
mount(".", "/", NULL, MS_MOVE, NULL);
chroot(".");
execve(init, argv, envp);
fprintf(stderr, "\n\n ... %s returned ... \n\n", argv[0]);
good_bye:
return 1;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mkinitramfs-kinit.sh
Type: application/x-sh
Size: 7167 bytes
Desc: not available
Url :
http://www.zytor.com/pipermail/klibc/attachments/20040608/2b4083b1/mkinitramfs-kinit.sh