1 Index: kexec-boot-loader.old/Makefile
2 ===================================================================
3 --- kexec-boot-loader.old.orig/Makefile 2006-05-31 10:52:30.000000000 -0600
4 +++ kexec-boot-loader.old/Makefile 2006-07-24 17:36:40.000000000 -0600
7 UCLIBCLIBS = $(UCLIBCPATH)/usr/lib/crt1.o $(UCLIBCPATH)/usr/lib/libc.a
9 -FILES = main.o mount.o ui.o nand.o usb.o $(KEXEC_FILES)
10 +FILES = main.o $(KEXEC_FILES)
12 olpc-boot-loader: $(FILES)
13 $(CC) -Xlinker $(LDFLAGS) -nostdlib -o $@ $(FILES) $(UCLIBCLIBS)
14 Index: kexec-boot-loader.old/main.c
15 ===================================================================
16 --- kexec-boot-loader.old.orig/main.c 2006-05-31 14:45:18.000000000 -0600
17 +++ kexec-boot-loader.old/main.c 2006-07-24 17:37:05.000000000 -0600
20 #include <sys/mount.h>
21 +#include <sys/stat.h>
29 -static char def_kernel_file[] = "bzImage";
30 -char *kernel_file = def_kernel_file;
32 -static char def_kernel_cmdline[] = "root=/dev/ram rw";
33 -char *kernel_cmdline = def_kernel_cmdline;
35 -char *initrd_file = NULL;
37 -char mntpoint[] = "/mntpoint";
41 - return do_mount(0, "/proc", "proc");
42 +void no(char *err, char *what) {
43 + print("no %s, %s\n", err, what);
48 +int stat_file(char *file)
52 + int ret, saved_errno;
54 - print("Kexec boot loader\n\n");
55 + ret = stat(file, &st);
57 + saved_errno = errno;
58 + print("failure to stat file at %s - errno=%d\n",
66 - create_mountpath(mntpoint);
67 +int main (int argc, char *argv[])
74 + char *kernel = argv[1], *cmd = argv[2], *init = argv[3];
76 - /* never return, we only get outside of this by booting
80 + printf("argc is %d, argv[1] %s, argv[2] %s, argv[3] %s\n", argc, argv[1], argv[2], argv[3]);
86 + if (stat_file(kernel))
87 + no("kernel", kernel);
89 - print("Select option:\n");
90 + ret = my_load(cmd, kernel, init);
92 + no("load", "failed");
94 - print("1 - boot from NAND flash (JFFS2)\n");
95 - print("2 - boot from USB device (EXT2)\n");
98 + no("exec", "failed");
100 - scanf("%1d", &opt);
106 - return load_exec_nand_image(kernel_file, kernel_cmdline,
109 - return load_exec_usb_image(kernel_file, kernel_cmdline,
112 - print("unsupported option!\n");