

#define SYS_open __NR_open #define SYS_read __NR_read #define SYS_write __NR_write #define SYS_close __NR_close
int read (int fd, void *ptr, int len)
{
return syscall(SYS_read, fd, ptr, len);
}
#include <stdlib.h>
extern char **environ;
extern int main(int argc,char **argv,char **envp);
void _start(int args)
{
/*
* The argument block begins above the current
* stack frame, because we have no return
* address. The calculation assumes that
* sizeof(int) == sizeof(void *). This is
* okay for i386 user space, but may be
* invalid in other cases.
*/
int *params = &args-1;
int argc = *params;
char **argv = (char **) (params+1);
environ = argv+argc+1;
exit(main(argc,argv,environ));
}
#include <stdio.h>
int main (int argc, char *argv[],
char *environ[])
{
printf("hello world\n");
return 0;
}
strongarm-linux-elf-gcc -v hello.c
cc1 -lang-c ... hello.c -o /tmp/ccuvJUpO.s as -o /tmp/ccsay5Hn.o /tmp/ccBNqUFj.s collect2 ... crt0.o -lgcc -lc /tmp/ccsay5Hn.o
fclose(stdout);
fclose(stderr);
usleep(1); /* this allows time for vmlinux to
flush its devices before we
terminate simulation */
__asm__ __volatile__ (
"mov r6, #0\n"
"mov pc, r6\n"
);
strongarm -g -o init hello.c
unpackstrongarmkernel
compilestrongarmkernel
unpackulinuxfs
createulinuxfs
simstrongarm
This document was produced using groff-1.19.