Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3666 → Rev 4153

/branches/network/uspace/app/init/init.c
27,9 → 27,9
*/
 
/** @addtogroup init Init
* @brief Init process for testing purposes.
* @brief Init process for user space environment configuration.
* @{
*/
*/
/**
* @file
*/
36,6 → 36,7
 
#include <stdio.h>
#include <unistd.h>
#include <ipc/ipc.h>
#include <vfs/vfs.h>
#include <bool.h>
#include <errno.h>
42,22 → 43,17
#include <fcntl.h>
#include <task.h>
#include <malloc.h>
#include <macros.h>
#include "init.h"
#include "version.h"
 
static void console_wait(void)
{
while (get_cons_phone() < 0)
usleep(50000); // FIXME
}
 
static bool mount_fs(const char *fstype)
{
int rc = -1;
while (rc < 0) {
rc = mount(fstype, "/", "initrd");
 
rc = mount(fstype, "/", "initrd", IPC_FLAG_BLOCKING);
switch (rc) {
case EOK:
printf(NAME ": Root filesystem mounted\n");
71,8 → 67,6
case ENOENT:
printf(NAME ": Unknown filesystem type (%s)\n", fstype);
return false;
default:
sleep(5); // FIXME
}
}
82,15 → 76,17
static void spawn(char *fname)
{
char *argv[2];
 
printf(NAME ": Spawning %s\n", fname);
 
argv[0] = fname;
argv[1] = NULL;
 
if (task_spawn(fname, argv) != 0) {
/* Success */
sleep(1);
if (task_spawn(fname, argv)) {
/* Add reasonable delay to avoid intermixed klog output. */
usleep(10000);
} else {
printf(NAME ": Error spawning %s\n", fname);
}
}
 
97,23 → 93,25
int main(int argc, char *argv[])
{
info_print();
sleep(5); // FIXME
if (!mount_fs("tmpfs") && !mount_fs("fat")) {
if (!mount_fs(STRING(RDFMT))) {
printf(NAME ": Exiting\n");
return -1;
}
// FIXME: spawn("/sbin/pci");
spawn("/sbin/fb");
spawn("/sbin/kbd");
// FIXME: spawn("/srv/pci");
spawn("/srv/fb");
spawn("/srv/kbd");
spawn("/sbin/networking_startup");
spawn("/sbin/console");
spawn("/srv/console");
spawn("/srv/fhc");
spawn("/srv/obio");
console_wait();
version_print();
spawn("/sbin/bdsh");
spawn("/app/klog");
spawn("/app/bdsh");
return 0;
}
/branches/network/uspace/app/init/version.c
35,19 → 35,20
 
#include <unistd.h>
#include <stdio.h>
#include <macros.h>
#include "init.h"
#include "version.h"
 
char *release = RELEASE;
char *release = STRING(RELEASE);
 
#ifdef REVISION
char *revision = ", revision " REVISION;
char *revision = ", revision " STRING(REVISION);
#else
char *revision = "";
#endif
 
#ifdef TIMESTAMP
char *timestamp = "\nBuilt on " TIMESTAMP;
char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
#else
char *timestamp = "";
#endif
60,7 → 61,8
/** Print version information. */
void version_print(void)
{
printf("HelenOS init\nRelease %s%s%s\nCopyright (c) 2006 HelenOS project\n", release, revision, timestamp);
printf("HelenOS init\nRelease %s%s%s\n", release, revision, timestamp);
printf("Copyright (c) 2001-2009 HelenOS project\n");
}
 
/** @}
/branches/network/uspace/app/init/Makefile
27,7 → 27,6
#
 
include ../../../version
include ../../Makefile.config
 
## Setup toolchain
#
34,21 → 33,14
 
LIBC_PREFIX = ../../lib/libc
SOFTINT_PREFIX = ../../lib/softint
 
include $(LIBC_PREFIX)/Makefile.toolchain
 
CFLAGS += -I../../srv/kbd/include
 
LIBS = $(LIBC_PREFIX)/libc.a
DEFS += -DRELEASE=\"$(RELEASE)\"
DEFS += -DRELEASE=$(RELEASE)
 
ifdef REVISION
DEFS += "-DREVISION=\"$(REVISION)\""
endif
 
ifdef TIMESTAMP
DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
endif
 
## Sources
#
 
66,13 → 58,13
-include Makefile.depend
 
clean:
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS)
 
depend:
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
 
$(OUTPUT): $(OBJECTS) $(LIBS)
$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
 
disasm: $(OUTPUT).disasm