File init.c changed (mode: 100644) (index d5de9ab..98b7f81) |
8 |
8 |
#include <ulinux/types.h> |
#include <ulinux/types.h> |
9 |
9 |
#include <ulinux/error.h> |
#include <ulinux/error.h> |
10 |
10 |
#include <ulinux/fs.h> |
#include <ulinux/fs.h> |
|
11 |
|
#include <ulinux/dirent.h> |
11 |
12 |
#include <ulinux/socket/socket.h> |
#include <ulinux/socket/socket.h> |
12 |
13 |
#include <ulinux/socket/netlink.h> |
#include <ulinux/socket/netlink.h> |
13 |
14 |
#ifdef DEBUG |
#ifdef DEBUG |
|
... |
... |
static void sigs_setup(void) |
41 |
42 |
OUTC("done\n"); |
OUTC("done\n"); |
42 |
43 |
} |
} |
43 |
44 |
|
|
44 |
|
static void proc_mount(void) |
|
45 |
|
{ |
|
46 |
|
OUTC(PRE "mounting proc..."); |
|
47 |
|
k_l r=sysc(mount,5,"proc","/proc","proc",K_MS_NOSUID|K_MS_NODEV|K_MS_NOEXEC, |
|
48 |
|
0); |
|
49 |
|
if(K_ISERR(r)){ |
|
50 |
|
OUT("ERROR:%ld\n",r); |
|
51 |
|
sysc(exit_group,1,-1); |
|
52 |
|
} |
|
53 |
|
OUTC("done\n"); |
|
54 |
|
} |
|
55 |
|
|
|
56 |
|
static void root_remount_rw(void) |
|
57 |
|
{ |
|
58 |
|
OUTC(PRE "remounting / as RW..."); |
|
59 |
|
k_l r=sysc(mount,5,0,"/",0,K_MS_REMOUNT,0); |
|
60 |
|
if(K_ISERR(r)){ |
|
61 |
|
OUT("ERROR:%ld\n",r); |
|
62 |
|
sysc(exit_group,1,-1); |
|
63 |
|
} |
|
64 |
|
OUTC("done\n"); |
|
65 |
|
} |
|
66 |
|
|
|
67 |
|
static void sysfs_mount(void) |
|
68 |
|
{ |
|
69 |
|
OUTC(PRE "mounting sysfs..."); |
|
70 |
|
k_l r=sysc(mount,5,"sysfs","/sys","sysfs",K_MS_NOSUID|K_MS_NODEV|K_MS_NOEXEC, |
|
71 |
|
0); |
|
72 |
|
if(K_ISERR(r)){ |
|
73 |
|
OUT("ERROR:%ld\n",r); |
|
74 |
|
sysc(exit_group,1,-1); |
|
75 |
|
} |
|
76 |
|
OUTC("done\n"); |
|
77 |
|
} |
|
78 |
|
|
|
79 |
45 |
void _start(void) |
void _start(void) |
80 |
46 |
{ |
{ |
81 |
47 |
# ifdef DEBUG |
# ifdef DEBUG |
|
... |
... |
void _start(void) |
87 |
53 |
g_dprintf_buf=dprintf_buf; |
g_dprintf_buf=dprintf_buf; |
88 |
54 |
# endif |
# endif |
89 |
55 |
sigs_setup(); |
sigs_setup(); |
90 |
|
proc_mount(); |
|
91 |
|
root_remount_rw(); |
|
92 |
|
sysfs_mount(); |
|
93 |
56 |
uevent_setup(); |
uevent_setup(); |
94 |
57 |
modules_load(); |
modules_load(); |
95 |
58 |
uevent_recv(); |
uevent_recv(); |
File modules.c changed (mode: 100644) (index 7dd1634..9b1a728) |
20 |
20 |
#include "globals.h" |
#include "globals.h" |
21 |
21 |
#include "modules_list.h" |
#include "modules_list.h" |
22 |
22 |
|
|
23 |
|
|
|
24 |
23 |
static void module_load(k_u8 *m) |
static void module_load(k_u8 *m) |
25 |
24 |
{ |
{ |
26 |
|
k_l fd=sysc(open,3,m,K_O_RDONLY,0); |
|
|
25 |
|
k_i fd=(k_i)sysc(open,3,m,K_O_RDONLY,0); |
27 |
26 |
if(K_ISERR(fd)){ |
if(K_ISERR(fd)){ |
28 |
|
OUTC("unable to open module\n"); |
|
|
27 |
|
OUT("unable to open module(%ld)\n",fd); |
29 |
28 |
goto err; |
goto err; |
30 |
29 |
} |
} |
31 |
30 |
|
|
32 |
31 |
struct k_stat m_stat; |
struct k_stat m_stat; |
33 |
32 |
k_l r=sysc(fstat,2,fd,&m_stat); |
k_l r=sysc(fstat,2,fd,&m_stat); |
34 |
33 |
if(K_ISERR(r)){ |
if(K_ISERR(r)){ |
35 |
|
OUTC("unable to stat module\n"); |
|
|
34 |
|
OUT("unable to stat module(%ld)\n",r); |
36 |
35 |
goto err; |
goto err; |
37 |
36 |
} |
} |
|
37 |
|
OUT("size=%lu...",m_stat.st_size); |
38 |
38 |
|
|
39 |
39 |
k_l addr=sysc(mmap,6,0,m_stat.st_size,K_PROT_READ, |
k_l addr=sysc(mmap,6,0,m_stat.st_size,K_PROT_READ, |
40 |
40 |
K_MAP_PRIVATE|K_MAP_POPULATE,fd,0); |
K_MAP_PRIVATE|K_MAP_POPULATE,fd,0); |
41 |
41 |
if(K_ISERR(addr)){ |
if(K_ISERR(addr)){ |
42 |
|
OUTC("unable to mmap module\n"); |
|
|
42 |
|
OUT("unable to mmap module(%ld)\n",addr); |
|
43 |
|
goto err; |
|
44 |
|
} |
|
45 |
|
|
|
46 |
|
r=sysc(init_module,3,addr,m_stat.st_size,""); |
|
47 |
|
if(K_ISERR(r)){ |
|
48 |
|
OUT("unable init module(%ld)\n",r); |
43 |
49 |
goto err; |
goto err; |
44 |
50 |
} |
} |
45 |
51 |
return; |
return; |
46 |
|
|
|
47 |
52 |
err: |
err: |
48 |
53 |
sysc(exit_group,1,-1); |
sysc(exit_group,1,-1); |
49 |
54 |
} |
} |