This is an old revision of the document!


How-to loader.o to preform a kexec like operations

loader.o allow you to run a custom kernel, without the danger of having to reprogram your Flash ROM. It loads a new kernel into memory and jumps to it directly.

Compiling loader.o

  1. In Makefile point INCLUDE = -isystem parameter to a 2.4.21-pre4 kernel header files!
  2. Fix gcc and ld entry in Makefile to meet your cross compiled toolchain.
  3. Apply initrd patch if you like.
  4. Run make

Use pre-compiled loader.o

If you think that compiling loader.o by yourself is too much hassle then you can use a pre-compiled loader.o

Preparing proper kernel image for loading

For kernel building instructions look kernel building wiki page.

Before you start compiling kernel you should apply this patch, which is going to fix memory detection problem.

--- arch/ppc/platforms/sandpoint_setup.c.orig	2007-08-09 18:02:58.000000000 -0400
+++ arch/ppc/platforms/sandpoint_setup.c	2007-08-09 18:03:41.000000000 -0400
@@ -451,8 +451,8 @@
 
 	/* This might be fixed in DINK32 12.4, or we'll have another
 	 * way to determine the correct memory size anyhow. */
-	/* return mpc10x_get_mem_size(MPC10X_MEM_MAP_B); */
-	return 16*1024*1024;
+	return mpc10x_get_mem_size(MPC10X_MEM_MAP_B);
+	/*return 16*1024*1024;*/
 }
 
 static void __init

After you have successfully built a kernel image you should note that the loader need the kernel to be in binary format. It can be done with powerpc-linux-objcopy command.

powerpc-linux-objcopy -O binary vmlinux

Using loader.o to load a kernel image

sync;insmod /mnt/HD_a2/loader.o kernel=/mnt/HD_a2/vmlinux

Personal Tools