From: Dustin M. <du...@se...> - 2001-09-03 20:23:52
|
I'm using Redboot with Yaegashi Takeshi's kernel boot loader support added. This copies a run time configurable parameter block to a specified address. I guess I could move this copy location to 0x210000 instead of 0x0. It would just get copied twice (to 0x210000 and then to 0x0), but that may not be a big deal. I guess I don't object to moving the parameter block location, as long as there is still a way to copy parameter blocks at run time. Dustin. > -----Original Message----- > From: lin...@li... > [mailto:lin...@li...]On Behalf Of David > Woodhouse > Sent: Monday, September 03, 2001 9:26 AM > To: linuxsh-dev > Subject: [linuxsh-dev] Parameter block with zImage. > > > When we load a zImage, we load it to 0x210000 and it decompresses the real > kernel image to 0x1000. > > The parameter block is in the first page of memory, and the zImage > decompression code doesn't touch it. The bootloader is expected > to load the > zImage to 0x210000 and the parameters to 0x0. > > Does anyone actually pass parameters to the kernel this way? I'd like to > change the address at which the zImage expects the parameter block to be > loaded - to load it to the beginning of the zImage just as we would > normally load it at the beginning of a vmlinux. > > The attached patch does this - moves the entry point of the zImage to > 0x211000 and makes it copy the parameter block from 0x210000 to 0 after > decompressing the kernel image to 0x1000 as before. > > It puts a jmp insn in at 0x210000 for backward compatibility with > bootloaders which don't look at the entry point of the loaded image. > > This would break parameter passing for anyone who is currently using a > zImage and passing parameters by putting the param block at the beginning > of memory. > > Is anyone actually doing that? > > Index: arch/sh/boot/compressed/Makefile > =================================================================== > RCS file: /cvsroot/linuxsh/kernel/arch/sh/boot/compressed/Makefile,v > retrieving revision 1.6 > diff -u -r1.6 Makefile > --- arch/sh/boot/compressed/Makefile 2000/10/03 00:47:32 1.6 > +++ arch/sh/boot/compressed/Makefile 2001/07/04 13:38:43 > @@ -19,8 +19,9 @@ > # ZIMAGE_OFFSET is the load offset of the compression loader > # > ZIMAGE_OFFSET = $(shell printf "0x%8x" > $$[0x80000000+0x$(CONFIG_MEMORY_START)+0x200000+0x10000]) > +ZIMAGE_ENTRY = $(shell printf "0x%8x" $$[$(ZIMAGE_OFFSET)+0x1000]) > > -ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS) > +ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS) -e $(ZIMAGE_ENTRY) > > all: vmlinux > > Index: arch/sh/boot/compressed/head.S > =================================================================== > RCS file: /cvsroot/linuxsh/kernel/arch/sh/boot/compressed/head.S,v > retrieving revision 1.5 > diff -u -r1.5 head.S > --- arch/sh/boot/compressed/head.S 2000/12/24 23:52:56 1.5 > +++ arch/sh/boot/compressed/head.S 2001/07/04 13:38:44 > @@ -8,7 +8,19 @@ > > #include <linux/linkage.h> > > + .global params > + > +params: > + mov.l startup_addr, r0 > + jmp @r0 > + > +startup_addr: > + .long startup > + > +.org 0x1000 > + > .global startup > + > startup: > /* Load initial status register */ > mov.l init_sr, r1 > Index: arch/sh/boot/compressed/misc.c > =================================================================== > RCS file: /cvsroot/linuxsh/kernel/arch/sh/boot/compressed/misc.c,v > retrieving revision 1.5 > diff -u -r1.5 misc.c > --- arch/sh/boot/compressed/misc.c 2000/07/20 15:55:00 1.5 > +++ arch/sh/boot/compressed/misc.c 2001/07/04 13:38:44 > @@ -96,6 +96,7 @@ > extern int _end; > static unsigned long free_mem_ptr; > static unsigned long free_mem_end_ptr; > +extern int params; > > #define HEAP_SIZE 0x10000 > > @@ -224,6 +225,18 @@ > long user_stack [STACK_SIZE]; > long* stack_start = &user_stack[STACK_SIZE]; > > +void copy_param_block(void) > +{ > + int i; > + > + unsigned long *src = (unsigned long *)¶ms; > + unsigned long *dst = (unsigned long *)&_text + 0x20000000; > + > + for(i=0; i<0x1000/4; i++) { > + dst[i]=src[i]; > + } > +} > + > void decompress_kernel(void) > { > output_data = 0; > @@ -231,6 +244,7 @@ > free_mem_ptr = (unsigned long)&_end; > free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; > > + copy_param_block(); > makecrc(); > puts("Uncompressing Linux... "); > gunzip(); > > -- > dwmw2 > > > > _______________________________________________ > linuxsh-dev mailing list > lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxsh-dev > |