1 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/au1xxx/head.S linux-2.6.16.7.new/arch/mips/boot/compressed/au1xxx/head.S
2 --- linux-2.6.16.7/arch/mips/boot/compressed/au1xxx/head.S 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/au1xxx/head.S 2006-05-04 23:08:18.000000000 +0200
6 + * arch/mips/kernel/head.S
8 + * This file is subject to the terms and conditions of the GNU General Public
9 + * License. See the file "COPYING" in the main directory of this archive
12 + * Copyright (C) 1994, 1995 Waldorf Electronics
13 + * Written by Ralf Baechle and Andreas Busse
14 + * Copyright (C) 1995 - 1999 Ralf Baechle
15 + * Copyright (C) 1996 Paul M. Antoine
16 + * Modified for DECStation and hence R3000 support by Paul M. Antoine
17 + * Further modifications by David S. Miller and Harald Koerfgen
18 + * Copyright (C) 1999 Silicon Graphics, Inc.
20 + * Head.S contains the MIPS exception handler and startup code.
22 + **************************************************************************
24 + * Added Cache Error exception handler and SBDDP EJTAG debug exception.
26 + * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
27 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
28 + **************************************************************************
30 +#include <linux/config.h>
31 +#include <linux/threads.h>
34 +#include <asm/cacheops.h>
35 +#include <asm/mipsregs.h>
36 +#include <asm/cachectl.h>
37 +#include <asm/regdef.h>
39 +#define IndexInvalidate_I 0x00
40 +#define IndexWriteBack_D 0x01
49 + subu s8, ra, 8 /* Where we were loaded */
50 + la sp, (.stack + 8192)
52 + move s0, a0 /* Save boot rom start args */
57 + la a0, start /* Where we were linked to run */
64 + /* copy text section */
81 + /* push the D-Cache and invalidate I-Cache */
82 + li k0, 0x80000000 # start address
83 + li k1, 0x80004000 # end address (16KB I-Cache)
88 + cache IndexWriteBack_D, 0(k0)
89 + cache IndexWriteBack_D, 32(k0)
90 + cache IndexWriteBack_D, 64(k0)
91 + cache IndexWriteBack_D, 96(k0)
92 + cache IndexInvalidate_I, 0(k0)
93 + cache IndexInvalidate_I, 32(k0)
94 + cache IndexInvalidate_I, 64(k0)
95 + cache IndexInvalidate_I, 96(k0)
102 + move a0, s8 /* load address */
103 + move a1, t1 /* length in words */
104 + move a2, t0 /* checksum */
108 + la k0, decompress_kernel
117 + li k0, KERNEL_ENTRY
123 + .comm .stack,4096*2,4
124 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/au1xxx/Makefile linux-2.6.16.7.new/arch/mips/boot/compressed/au1xxx/Makefile
125 --- linux-2.6.16.7/arch/mips/boot/compressed/au1xxx/Makefile 1970-01-01 01:00:00.000000000 +0100
126 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/au1xxx/Makefile 2006-05-04 23:08:18.000000000 +0200
128 +# arch/mips/boot/compressed/au1xxx/Makefile
130 +# Makefile for AMD Alchemy Semiconductor Au1x based boards.
131 +# All of the boot loader code was derived from the ppc
134 +# Copyright 2001,2002 MontaVista Software Inc.
136 +# Author: Mark A. Greer
139 +# Copyright 2004 Embedded Alley Solutions, Inc
140 +# Ported and modified for mips 2.6 support by
141 +# Pete Popov <ppopov@embeddedalley.com>
143 +# This program is free software; you can redistribute it and/or modify it
144 +# under the terms of the GNU General Public License as published by the
145 +# Free Software Foundation; either version 2 of the License, or (at your
146 +# option) any later version.
148 +boot := arch/mips/boot
149 +compressed := $(boot)/compressed
150 +utils := $(compressed)/utils
151 +lib := $(compressed)/lib
152 +images := $(compressed)/images
153 +common := $(compressed)/common
155 +#########################################################################
156 +# START BOARD SPECIFIC VARIABLES
158 +# These two variables control where the zImage is stored
159 +# in flash and loaded in memory. It only controls how the srec
160 +# file is generated, the code is the same.
161 +RAM_RUN_ADDR = 0x81000000
163 +ifdef CONFIG_MIPS_XXS1500
164 +FLASH_LOAD_ADDR = 0xBF000000
166 +FLASH_LOAD_ADDR = 0xBFD00000
169 +# These two variables specify the free ram region
170 +# that can be used for temporary malloc area
171 +AVAIL_RAM_START=0x80500000
172 +AVAIL_RAM_END=0x80900000
174 +# This one must match the LOADADDR in arch/mips/Makefile!
177 +# WARNING WARNING WARNING
178 +# Note that with a LOADADDR of 0x80100000 and AVAIL_RAM_START of
179 +# 0x80500000, the max decompressed kernel size can be 4MB. Else we
180 +# start overwriting ourselve. You can change these vars as needed;
181 +# it would be much better if we just figured everything out on the fly.
183 +# END BOARD SPECIFIC VARIABLES
184 +#########################################################################
186 +OBJECTS := $(obj)/head.o $(common)/misc-common.o $(common)/misc-simple.o \
187 + $(common)/au1k_uart.o
188 +LIBS := $(lib)/lib.a
190 +ENTRY := $(utils)/entry
191 +OFFSET := $(utils)/offset
192 +SIZE := $(utils)/size
194 +LD_ARGS := -T $(compressed)/ld.script -Ttext $(RAM_RUN_ADDR) -Bstatic
196 +ifdef CONFIG_CPU_LITTLE_ENDIAN
197 +OBJCOPY_ARGS = -O elf32-tradlittlemips
199 +OBJCOPY_ARGS = -O elf32-tradbigmips
202 +$(obj)/head.o: $(obj)/head.S $(TOPDIR)/vmlinux
203 + $(CC) -I $(TOPDIR)/include $(AFLAGS) \
204 + -DKERNEL_ENTRY=$(shell sh $(ENTRY) $(NM) $(TOPDIR)/vmlinux ) \
207 +$(common)/misc-simple.o:
208 + $(CC) -I $(TOPDIR)/include $(CFLAGS) -DINITRD_OFFSET=0 -DINITRD_SIZE=0 -DZIMAGE_OFFSET=0 \
209 + -DAVAIL_RAM_START=$(AVAIL_RAM_START) \
210 + -DAVAIL_RAM_END=$(AVAIL_RAM_END) \
211 + -DLOADADDR=$(LOADADDR) \
212 + -DZIMAGE_SIZE=0 -c -o $@ $*.c
214 +$(obj)/zvmlinux: $(OBJECTS) $(LIBS) $(srctree)/$(compressed)/ld.script $(images)/vmlinux.gz $(common)/dummy.o
216 + --add-section=.image=$(images)/vmlinux.gz \
217 + --set-section-flags=.image=contents,alloc,load,readonly,data \
218 + $(common)/dummy.o $(common)/image.o
219 + $(LD) $(LD_ARGS) -o $@ $(OBJECTS) $(common)/image.o $(LIBS)
220 + $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R __kcrctab -R __ksymtab_strings \
221 + -R .comment -R .stab -R .stabstr -R .initrd -R .sysmap
223 +# Here we manipulate the image in order to get it the necessary
224 +# srecord file we need.
225 +zImage: $(obj)/zvmlinux
226 + mv $(obj)/zvmlinux $(images)/zImage
227 + $(OBJCOPY) -O srec $(images)/zImage $(images)/zImage.srec
228 + $(OBJCOPY) -O binary $(images)/zImage $(images)/zImage.bin
230 +zImage.flash: zImage
232 + flash=${FLASH_LOAD_ADDR} ; \
233 + ram=${RAM_RUN_ADDR} ; \
234 + adjust=$$[ $$flash - $$ram ] ; \
235 + $(OBJCOPY) -O srec --adjust-vma `printf '0x%08x' $$adjust` \
236 + $(images)/zImage $(images)/zImage.flash.srec ; \
238 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/common/au1k_uart.c linux-2.6.16.7.new/arch/mips/boot/compressed/common/au1k_uart.c
239 --- linux-2.6.16.7/arch/mips/boot/compressed/common/au1k_uart.c 1970-01-01 01:00:00.000000000 +0100
240 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/common/au1k_uart.c 2006-05-04 23:08:18.000000000 +0200
243 + * BRIEF MODULE DESCRIPTION
244 + * Simple Au1000 uart routines.
246 + * Copyright 2001 MontaVista Software Inc.
247 + * Author: MontaVista Software, Inc.
248 + * ppopov@mvista.com or source@mvista.com
250 + * This program is free software; you can redistribute it and/or modify it
251 + * under the terms of the GNU General Public License as published by the
252 + * Free Software Foundation; either version 2 of the License, or (at your
253 + * option) any later version.
255 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
256 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
257 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
258 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
259 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
260 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
261 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
262 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
263 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
264 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
266 + * You should have received a copy of the GNU General Public License along
267 + * with this program; if not, write to the Free Software Foundation, Inc.,
268 + * 675 Mass Ave, Cambridge, MA 02139, USA.
270 +#include <linux/config.h>
272 +#include <asm/mach-au1x00/au1000.h>
273 +#include "ns16550.h"
275 +typedef unsigned char uint8;
276 +typedef unsigned int uint32;
278 +#define UART16550_BAUD_2400 2400
279 +#define UART16550_BAUD_4800 4800
280 +#define UART16550_BAUD_9600 9600
281 +#define UART16550_BAUD_19200 19200
282 +#define UART16550_BAUD_38400 38400
283 +#define UART16550_BAUD_57600 57600
284 +#define UART16550_BAUD_115200 115200
286 +#define UART16550_PARITY_NONE 0
287 +#define UART16550_PARITY_ODD 0x08
288 +#define UART16550_PARITY_EVEN 0x18
289 +#define UART16550_PARITY_MARK 0x28
290 +#define UART16550_PARITY_SPACE 0x38
292 +#define UART16550_DATA_5BIT 0x0
293 +#define UART16550_DATA_6BIT 0x1
294 +#define UART16550_DATA_7BIT 0x2
295 +#define UART16550_DATA_8BIT 0x3
297 +#define UART16550_STOP_1BIT 0x0
298 +#define UART16550_STOP_2BIT 0x4
300 +/* It would be nice if we had a better way to do this.
301 + * It could be a variable defined in one of the board specific files.
304 +#ifdef CONFIG_COGENT_CSB250
305 +#define UART_BASE UART3_ADDR
307 +#define UART_BASE UART0_ADDR
310 +/* memory-mapped read/write of the port */
311 +#define UART16550_READ(y) (au_readl(UART_BASE + y) & 0xff)
312 +#define UART16550_WRITE(y,z) (au_writel(z&0xff, UART_BASE + y))
315 + * We use uart 0, which is already initialized by
318 +volatile struct NS16550 *
319 +serial_init(int chan)
321 + volatile struct NS16550 *com_port;
322 + com_port = (struct NS16550 *) UART_BASE;
327 +serial_putc(volatile struct NS16550 *com_port, unsigned char c)
329 + while ((UART16550_READ(UART_LSR)&0x40) == 0);
330 + UART16550_WRITE(UART_TX, c);
334 +serial_getc(volatile struct NS16550 *com_port)
336 + while((UART16550_READ(UART_LSR) & 0x1) == 0);
337 + return UART16550_READ(UART_RX);
341 +serial_tstc(volatile struct NS16550 *com_port)
343 + return((UART16550_READ(UART_LSR) & LSR_DR) != 0);
345 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/common/dummy.c linux-2.6.16.7.new/arch/mips/boot/compressed/common/dummy.c
346 --- linux-2.6.16.7/arch/mips/boot/compressed/common/dummy.c 1970-01-01 01:00:00.000000000 +0100
347 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/common/dummy.c 2006-05-04 23:08:18.000000000 +0200
353 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/common/Makefile linux-2.6.16.7.new/arch/mips/boot/compressed/common/Makefile
354 --- linux-2.6.16.7/arch/mips/boot/compressed/common/Makefile 1970-01-01 01:00:00.000000000 +0100
355 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/common/Makefile 2006-05-04 23:08:18.000000000 +0200
358 +# arch/mips/boot/compressed/common/Makefile
360 +# This file is subject to the terms and conditions of the GNU General Public
361 +# License. See the file "COPYING" in the main directory of this archive
364 +# Tom Rini January 2001
369 +lib-y := misc-common.o no_initrd.o dummy.o
370 +lib-$(CONFIG_SOC_AU1X00) += au1k_uart.o
371 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/common/misc-common.c linux-2.6.16.7.new/arch/mips/boot/compressed/common/misc-common.c
372 --- linux-2.6.16.7/arch/mips/boot/compressed/common/misc-common.c 1970-01-01 01:00:00.000000000 +0100
373 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/common/misc-common.c 2006-05-04 23:08:18.000000000 +0200
376 + * arch/mips/boot/compressed/common/misc-common.c
378 + * Misc. bootloader code (almost) all platforms can use
380 + * Author: Johnnie Peters <jpeters@mvista.com>
381 + * Editor: Tom Rini <trini@mvista.com>
383 + * Derived from arch/ppc/boot/prep/misc.c
385 + * Ported by Pete Popov <ppopov@mvista.com> to
386 + * support mips board(s). I also got rid of the vga console
389 + * Copyright 2000-2001 MontaVista Software Inc.
391 + * Ported to MIPS 2.6 by Pete Popov, <ppopov@embeddedalley.com>
393 + * This program is free software; you can redistribute it and/or modify it
394 + * under the terms of the GNU General Public License as published by the
395 + * Free Software Foundation; either version 2 of the License, or (at your
396 + * option) any later version.
398 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
399 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
400 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
401 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
402 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
403 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
404 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
405 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
406 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
407 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
409 + * You should have received a copy of the GNU General Public License along
410 + * with this program; if not, write to the Free Software Foundation, Inc.,
411 + * 675 Mass Ave, Cambridge, MA 02139, USA.
414 +#include <stdarg.h> /* for va_ bits */
415 +#include <linux/config.h>
416 +#include <linux/string.h>
417 +#include <linux/zlib.h>
419 +extern char *avail_ram;
420 +extern char *end_avail;
423 +void puts(const char *);
424 +void putc(const char c);
425 +void puthex(unsigned long val);
426 +void _bcopy(char *src, char *dst, int len);
427 +void gunzip(void *, int, unsigned char *, int *);
428 +static int _cvt(unsigned long val, char *buf, long radix, char *digits);
430 +void _vprintk(void(*)(const char), const char *, va_list ap);
432 +struct NS16550 *com_port;
434 +int serial_tstc(volatile struct NS16550 *);
435 +unsigned char serial_getc(volatile struct NS16550 *);
436 +void serial_putc(volatile struct NS16550 *, unsigned char);
451 + return (serial_tstc(com_port));
457 + if (serial_tstc(com_port))
458 + return (serial_getc(com_port));
465 + serial_putc(com_port, c);
467 + serial_putc(com_port, '\r');
470 +void puts(const char *s)
473 + while ( ( c = *s++ ) != '\0' ) {
474 + serial_putc(com_port, c);
475 + if ( c == '\n' ) serial_putc(com_port, '\r');
483 + puts("\n\n -- System halted");
485 + while(1); /* Halt */
488 +static void *zalloc(unsigned size)
490 + void *p = avail_ram;
492 + size = (size + 7) & -8;
494 + if (avail_ram > end_avail) {
495 + puts("oops... out of memory\n");
503 +#define EXTRA_FIELD 4
505 +#define COMMENT 0x10
506 +#define RESERVED 0xe0
510 +void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
518 + if (src[2] != Z_DEFLATED || (flags & RESERVED) != 0) {
519 + puts("bad gzipped data\n");
522 + if ((flags & EXTRA_FIELD) != 0)
523 + i = 12 + src[10] + (src[11] << 8);
524 + if ((flags & ORIG_NAME) != 0)
525 + while (src[i++] != 0)
527 + if ((flags & COMMENT) != 0)
528 + while (src[i++] != 0)
530 + if ((flags & HEAD_CRC) != 0)
533 + puts("gunzip: ran out of data in header\n");
537 + /* Initialize ourself. */
538 + s.workspace = zalloc(zlib_inflate_workspacesize());
539 + r = zlib_inflateInit2(&s, -MAX_WBITS);
541 + puts("zlib_inflateInit2 returned "); puthex(r); puts("\n");
544 + s.next_in = src + i;
545 + s.avail_in = *lenp - i;
547 + s.avail_out = dstlen;
548 + r = zlib_inflate(&s, Z_FINISH);
549 + if (r != Z_OK && r != Z_STREAM_END) {
550 + puts("inflate returned "); puthex(r); puts("\n");
553 + *lenp = s.next_out - (unsigned char *) dst;
554 + zlib_inflateEnd(&s);
558 +puthex(unsigned long val)
561 + unsigned char buf[10];
563 + for (i = 7; i >= 0; i--)
565 + buf[i] = "0123456789ABCDEF"[val & 0x0F];
576 +_printk(char const *fmt, ...)
581 + _vprintk(putc, fmt, ap);
586 +#define is_digit(c) ((c >= '0') && (c <= '9'))
589 +_vprintk(void(*putc)(const char), const char *fmt0, va_list ap)
591 + char c, sign, *cp = 0;
592 + int left_prec, right_prec, zero_fill, length = 0, pad, pad_on_right;
595 + while ((c = *fmt0++))
600 + left_prec = right_prec = pad_on_right = 0;
614 + while (is_digit(c))
616 + left_prec = (left_prec * 10) + (c - '0');
623 + while (is_digit(c))
625 + right_prec = (right_prec * 10) + (c - '0');
630 + right_prec = left_prec;
638 + val = va_arg(ap, long);
647 + length = _cvt(val, buf, 10, "0123456789");
650 + length = _cvt(val, buf, 16, "0123456789abcdef");
653 + length = _cvt(val, buf, 16, "0123456789ABCDEF");
659 + cp = va_arg(ap, char *);
660 + length = strlen(cp);
663 + c = va_arg(ap, long /*char*/);
669 + pad = left_prec - length;
697 + while (length-- > 0)
699 + (*putc)(c = *cp++);
724 +_cvt(unsigned long val, char *buf, long radix, char *digits)
730 + { /* Special case */
735 + *cp++ = digits[val % radix];
748 +_dump_buf_with_offset(unsigned char *p, int s, unsigned char *base)
751 + if ((unsigned int)s > (unsigned int)p)
753 + s = (unsigned int)s - (unsigned int)p;
759 + _printk("%06X: ", (int)p - (int)base);
762 + _printk("%06X: ", p);
764 + for (i = 0; i < 16; i++)
768 + _printk("%02X", p[i] & 0xFF);
773 + if ((i % 2) == 1) _printk(" ");
774 + if ((i % 8) == 7) _printk(" ");
777 + for (i = 0; i < 16; i++)
782 + if ((c < 0x20) || (c >= 0x7F)) c = '.';
796 +_dump_buf(unsigned char *p, int s)
799 + _dump_buf_with_offset(p, s, 0);
804 + * c-indent-level: 8
805 + * c-basic-offset: 8
809 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/common/misc-simple.c linux-2.6.16.7.new/arch/mips/boot/compressed/common/misc-simple.c
810 --- linux-2.6.16.7/arch/mips/boot/compressed/common/misc-simple.c 1970-01-01 01:00:00.000000000 +0100
811 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/common/misc-simple.c 2006-05-04 23:08:18.000000000 +0200
814 + * arch/mips/zboot/common/misc-simple.c
816 + * Misc. bootloader code for many machines. This assumes you have are using
817 + * a 6xx/7xx/74xx CPU in your machine. This assumes the chunk of memory
818 + * below 8MB is free. Finally, it assumes you have a NS16550-style uart for
819 + * your serial console. If a machine meets these requirements, it can quite
820 + * likely use this code during boot.
822 + * Author: Matt Porter <mporter@mvista.com>
823 + * Derived from arch/ppc/boot/prep/misc.c
825 + * Copyright 2001 MontaVista Software Inc.
827 + * This program is free software; you can redistribute it and/or modify it
828 + * under the terms of the GNU General Public License as published by the
829 + * Free Software Foundation; either version 2 of the License, or (at your
830 + * option) any later version.
833 +#include <linux/types.h>
834 +#include <linux/elf.h>
835 +#include <linux/config.h>
837 +#include <asm/page.h>
839 +#include "linux/zlib.h"
841 +extern struct NS16550 *com_port;
848 +#ifdef CONFIG_CMDLINE
849 +#define CMDLINE CONFIG_CMDLINE
853 +char cmd_preset[] = CMDLINE;
855 +char *cmd_line = cmd_buf;
857 +/* The linker tells us where the image is.
859 +extern unsigned char __image_begin, __image_end;
860 +extern unsigned char __ramdisk_begin, __ramdisk_end;
861 +unsigned long initrd_size;
863 +extern void puts(const char *);
864 +extern void putc(const char c);
865 +extern void puthex(unsigned long val);
866 +extern void *memcpy(void * __dest, __const void * __src,
867 + __kernel_size_t __n);
868 +extern void gunzip(void *, int, unsigned char *, int *);
869 +extern void udelay(long delay);
870 +extern int tstc(void);
871 +extern int getc(void);
872 +extern volatile struct NS16550 *serial_init(int chan);
875 +decompress_kernel(unsigned long load_addr, int num_words,
876 + unsigned long cksum, unsigned long *sp)
878 + extern unsigned long start;
881 + com_port = (struct NS16550 *)serial_init(0);
883 + initrd_size = (unsigned long)(&__ramdisk_end) -
884 + (unsigned long)(&__ramdisk_begin);
887 + * Reveal where we were loaded at and where we
888 + * were relocated to.
890 + puts("loaded at: "); puthex(load_addr);
891 + puts(" "); puthex((unsigned long)(load_addr + (4*num_words))); puts("\n");
892 + if ( (unsigned long)load_addr != (unsigned long)&start )
894 + puts("relocated to: "); puthex((unsigned long)&start);
896 + puthex((unsigned long)((unsigned long)&start + (4*num_words)));
901 + * We link ourself to an arbitrary low address. When we run, we
902 + * relocate outself to that address. __image_being points to
903 + * the part of the image where the zImage is. -- Tom
905 + zimage_start = (char *)(unsigned long)(&__image_begin);
906 + zimage_size = (unsigned long)(&__image_end) -
907 + (unsigned long)(&__image_begin);
910 + * The zImage and initrd will be between start and _end, so they've
911 + * already been moved once. We're good to go now. -- Tom
913 + puts("zimage at: "); puthex((unsigned long)zimage_start);
914 + puts(" "); puthex((unsigned long)(zimage_size+zimage_start));
917 + if ( initrd_size ) {
918 + puts("initrd at: ");
919 + puthex((unsigned long)(&__ramdisk_begin));
920 + puts(" "); puthex((unsigned long)(&__ramdisk_end));puts("\n");
923 + /* assume the chunk below 8M is free */
924 + avail_ram = (char *)AVAIL_RAM_START;
925 + end_avail = (char *)AVAIL_RAM_END;
927 + /* Display standard Linux/MIPS boot prompt for kernel args */
928 + puts("Uncompressing Linux at load address ");
931 + /* I don't like this hard coded gunzip size (fixme) */
932 + gunzip((void *)LOADADDR, 0x400000, zimage_start, &zimage_size);
933 + puts("Now booting the kernel\n");
935 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/common/no_initrd.c linux-2.6.16.7.new/arch/mips/boot/compressed/common/no_initrd.c
936 --- linux-2.6.16.7/arch/mips/boot/compressed/common/no_initrd.c 1970-01-01 01:00:00.000000000 +0100
937 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/common/no_initrd.c 2006-05-04 23:08:18.000000000 +0200
939 +char initrd_data[1];
941 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/images/Makefile linux-2.6.16.7.new/arch/mips/boot/compressed/images/Makefile
942 --- linux-2.6.16.7/arch/mips/boot/compressed/images/Makefile 1970-01-01 01:00:00.000000000 +0100
943 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/images/Makefile 2006-05-04 23:08:18.000000000 +0200
947 +# This dir holds all of the images for MIPS machines.
948 +# Tom Rini January 2001
951 +extra-y := vmlinux.bin vmlinux.gz
953 +OBJCOPYFLAGS_vmlinux.bin := -O binary
954 +$(obj)/vmlinux.bin: vmlinux FORCE
955 + $(call if_changed,objcopy)
957 +$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
958 + $(call if_changed,gzip)
960 +# Files generated that shall be removed upon make clean
961 +clean-files := vmlinux* zImage*
962 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/include/nonstdio.h linux-2.6.16.7.new/arch/mips/boot/compressed/include/nonstdio.h
963 --- linux-2.6.16.7/arch/mips/boot/compressed/include/nonstdio.h 1970-01-01 01:00:00.000000000 +0100
964 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/include/nonstdio.h 2006-05-04 23:08:18.000000000 +0200
967 + * Copyright (C) Paul Mackerras 1997.
969 + * This program is free software; you can redistribute it and/or
970 + * modify it under the terms of the GNU General Public License
971 + * as published by the Free Software Foundation; either version
972 + * 2 of the License, or (at your option) any later version.
975 +extern FILE *stdin, *stdout;
976 +#define NULL ((void *)0)
978 +#define fopen(n, m) NULL
981 +extern char *fgets();
983 +#define perror(s) printf("%s: no files!\n", (s))
984 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/include/ns16550.h linux-2.6.16.7.new/arch/mips/boot/compressed/include/ns16550.h
985 --- linux-2.6.16.7/arch/mips/boot/compressed/include/ns16550.h 1970-01-01 01:00:00.000000000 +0100
986 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/include/ns16550.h 2006-05-04 23:08:18.000000000 +0200
989 + * NS16550 Serial Port
993 + * Figure out which file will have the definitons of COMx
996 +/* Some machines have their uart registers 16 bytes apart. Most don't.
997 + * TODO: Make this work like drivers/char/serial does - Tom */
998 +#if !defined(UART_REG_PAD)
999 +#define UART_REG_PAD(x)
1004 + unsigned char rbr; /* 0 */
1006 + unsigned char ier; /* 1 */
1008 + unsigned char fcr; /* 2 */
1010 + unsigned char lcr; /* 3 */
1012 + unsigned char mcr; /* 4 */
1014 + unsigned char lsr; /* 5 */
1016 + unsigned char msr; /* 6 */
1018 + unsigned char scr; /* 7 */
1026 +#define LSR_DR 0x01 /* Data ready */
1027 +#define LSR_OE 0x02 /* Overrun */
1028 +#define LSR_PE 0x04 /* Parity error */
1029 +#define LSR_FE 0x08 /* Framing error */
1030 +#define LSR_BI 0x10 /* Break */
1031 +#define LSR_THRE 0x20 /* Xmit holding register empty */
1032 +#define LSR_TEMT 0x40 /* Xmitter empty */
1033 +#define LSR_ERR 0x80 /* Error */
1034 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/include/pb1000_serial.h linux-2.6.16.7.new/arch/mips/boot/compressed/include/pb1000_serial.h
1035 --- linux-2.6.16.7/arch/mips/boot/compressed/include/pb1000_serial.h 1970-01-01 01:00:00.000000000 +0100
1036 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/include/pb1000_serial.h 2006-05-04 23:08:18.000000000 +0200
1039 + * arch/ppc/boot/include/sandpoint_serial.h
1041 + * Location of the COM ports on Motorola SPS Sandpoint machines
1043 + * Author: Mark A. Greer
1044 + * mgreer@mvista.com
1046 + * Copyright 2001 MontaVista Software Inc.
1048 + * This program is free software; you can redistribute it and/or modify it
1049 + * under the terms of the GNU General Public License as published by the
1050 + * Free Software Foundation; either version 2 of the License, or (at your
1051 + * option) any later version.
1054 +#define COM1 0xfe0003f8
1055 +#define COM2 0xfe0002f8
1056 +#define COM3 0x00000000 /* No COM3 */
1057 +#define COM4 0x00000000 /* No COM4 */
1058 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/ld.script linux-2.6.16.7.new/arch/mips/boot/compressed/ld.script
1059 --- linux-2.6.16.7/arch/mips/boot/compressed/ld.script 1970-01-01 01:00:00.000000000 +0100
1060 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/ld.script 2006-05-04 23:08:18.000000000 +0200
1066 + /* Read-only sections, merged into text segment: */
1067 + /* . = 0x81000000; */
1068 + .init : { *(.init) } =0
1073 + *(.rodata) *(.rodata.*)
1075 + /* .gnu.warning sections are handled specially by elf32.em. */
1078 + .kstrtab : { *(.kstrtab) }
1080 + . = ALIGN(16); /* Exception table */
1081 + __start___ex_table = .;
1082 + __ex_table : { *(__ex_table) }
1083 + __stop___ex_table = .;
1085 + __start___dbe_table = .; /* Exception table for data bus errors */
1086 + __dbe_table : { *(__dbe_table) }
1087 + __stop___dbe_table = .;
1089 + __start___ksymtab = .; /* Kernel symbol table */
1090 + __ksymtab : { *(__ksymtab) }
1091 + __stop___ksymtab = .;
1096 + .data.init_task : { *(.data.init_task) }
1098 + /* Startup code */
1101 + .text.init : { *(.text.init) }
1102 + .data.init : { *(.data.init) }
1104 + __setup_start = .;
1105 + .setup.init : { *(.setup.init) }
1107 + __initcall_start = .;
1108 + .initcall.init : { *(.initcall.init) }
1109 + __initcall_end = .;
1110 + . = ALIGN(4096); /* Align double page for init_task_union */
1114 + .data.page_aligned : { *(.data.idt) }
1117 + .data.cacheline_aligned : { *(.data.cacheline_aligned) }
1119 + .fini : { *(.fini) } =0
1120 + .reginfo : { *(.reginfo) }
1121 + /* Adjust the address for the data segment. We want to adjust up to
1122 + the same address within the page on the next page up. It would
1123 + be more correct to do this:
1125 + The current expression does not correctly handle the case of a
1126 + text segment ending precisely at the end of a page; it causes the
1127 + data segment to skip a page. The above expression does not have
1128 + this problem, but it will currently (2/95) cause BFD to allocate
1129 + a single segment, combining both text and data, for this case.
1130 + This will prevent the text segment from being shared among
1131 + multiple executions of the program; I think that is more
1132 + important than losing a page of the virtual address space (note
1133 + that no actual memory is lost; the page which is skipped can not
1134 + be referenced). */
1141 + /* Put the compressed image here, so bss is on the end. */
1142 + __image_begin = .;
1145 + /* Align the initial ramdisk image (INITRD) on page boundaries. */
1147 + __ramdisk_begin = .;
1149 + __ramdisk_end = .;
1154 + .data1 : { *(.data1) }
1156 + .lit8 : { *(.lit8) }
1157 + .lit4 : { *(.lit4) }
1158 + .ctors : { *(.ctors) }
1159 + .dtors : { *(.dtors) }
1160 + .got : { *(.got.plt) *(.got) }
1161 + .dynamic : { *(.dynamic) }
1162 + /* We want the small data sections together, so single-instruction offsets
1163 + can access them all, and initialized data all before uninitialized, so
1164 + we can shorten the on-disk segment size. */
1165 + .sdata : { *(.sdata) }
1168 + PROVIDE (edata = .);
1172 + .sbss : { *(.sbss) *(.scommon) }
1180 + PROVIDE (end = .);
1183 + /* Sections to be discarded */
1191 + /* This is the MIPS specific mdebug section. */
1192 + .mdebug : { *(.mdebug) }
1193 + /* These are needed for ELF backends which have not yet been
1194 + converted to the new style linker. */
1195 + .stab 0 : { *(.stab) }
1196 + .stabstr 0 : { *(.stabstr) }
1197 + /* DWARF debug sections.
1198 + Symbols in the .debug DWARF section are relative to the beginning of the
1199 + section so we begin .debug at 0. It's not clear yet what needs to happen
1200 + for the others. */
1201 + .debug 0 : { *(.debug) }
1202 + .debug_srcinfo 0 : { *(.debug_srcinfo) }
1203 + .debug_aranges 0 : { *(.debug_aranges) }
1204 + .debug_pubnames 0 : { *(.debug_pubnames) }
1205 + .debug_sfnames 0 : { *(.debug_sfnames) }
1206 + .line 0 : { *(.line) }
1207 + /* These must appear regardless of . */
1208 + .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
1209 + .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
1210 + .comment : { *(.comment) }
1211 + .note : { *(.note) }
1213 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/lib/Makefile linux-2.6.16.7.new/arch/mips/boot/compressed/lib/Makefile
1214 --- linux-2.6.16.7/arch/mips/boot/compressed/lib/Makefile 1970-01-01 01:00:00.000000000 +0100
1215 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/lib/Makefile 2006-05-04 23:08:18.000000000 +0200
1219 +# Makefile for some libs needed by zImage.
1222 +lib-y := $(addprefix ../../../../../lib/zlib_inflate/, \
1223 + infblock.o infcodes.o inffast.o inflate.o inftrees.o infutil.o) \
1224 + $(addprefix ../../../../../lib/, ctype.o string.o) \
1225 + $(addprefix ../../../../../arch/mips/lib/, memcpy.o) \
1228 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/Makefile linux-2.6.16.7.new/arch/mips/boot/compressed/Makefile
1229 --- linux-2.6.16.7/arch/mips/boot/compressed/Makefile 1970-01-01 01:00:00.000000000 +0100
1230 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/Makefile 2006-05-04 23:08:18.000000000 +0200
1234 +# arch/mips/boot/compressed/Makefile
1236 +# This file is subject to the terms and conditions of the GNU General Public
1237 +# License. See the file "COPYING" in the main directory of this archive
1238 +# for more details.
1240 +# Copyright (C) 1994 by Linus Torvalds
1241 +# Adapted for PowerPC by Gary Thomas
1242 +# modified by Cort (cort@cs.nmt.edu)
1244 +# Ported to MIPS by Pete Popov, ppopov@embeddedalley.com
1247 +boot := arch/mips/boot
1248 +compressed := arch/mips/boot/compressed
1250 +CFLAGS += -fno-builtin -D__BOOTER__ -I$(compressed)/include
1252 +BOOT_TARGETS = zImage zImage.flash
1254 +bootdir-$(CONFIG_SOC_AU1X00) := au1xxx
1255 +subdir-y := common lib images
1257 +.PHONY: $(BOOT_TARGETS) $(bootdir-y)
1259 +$(BOOT_TARGETS): $(bootdir-y)
1261 +$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
1262 + $(addprefix $(obj)/,$(hostprogs-y))
1263 + $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
1264 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/utils/entry linux-2.6.16.7.new/arch/mips/boot/compressed/utils/entry
1265 --- linux-2.6.16.7/arch/mips/boot/compressed/utils/entry 1970-01-01 01:00:00.000000000 +0100
1266 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/utils/entry 2006-05-04 23:08:18.000000000 +0200
1270 +# grab the kernel_entry address from the vmlinux elf image
1271 +entry=`$1 $2 | grep kernel_entry`
1273 +fs=`echo $entry | grep ffffffff` # check toolchain output
1275 +if [ -n "$fs" ]; then
1276 + echo "0x"`$1 $2 | grep kernel_entry | cut -c9- | awk '{print $1}'`
1278 + echo "0x"`$1 $2 | grep kernel_entry | cut -c1- | awk '{print $1}'`
1280 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/utils/offset linux-2.6.16.7.new/arch/mips/boot/compressed/utils/offset
1281 --- linux-2.6.16.7/arch/mips/boot/compressed/utils/offset 1970-01-01 01:00:00.000000000 +0100
1282 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/utils/offset 2006-05-04 23:08:18.000000000 +0200
1286 +echo "0x"`$1 -h $2 | grep $3 | grep -v zvmlinux| awk '{print $6}'`
1287 diff -urN linux-2.6.16.7/arch/mips/boot/compressed/utils/size linux-2.6.16.7.new/arch/mips/boot/compressed/utils/size
1288 --- linux-2.6.16.7/arch/mips/boot/compressed/utils/size 1970-01-01 01:00:00.000000000 +0100
1289 +++ linux-2.6.16.7.new/arch/mips/boot/compressed/utils/size 2006-05-04 23:08:18.000000000 +0200
1293 +OFFSET=`$1 -h $2 | grep $3 | grep -v zvmlinux | awk '{print $3}'`
1295 diff -urN linux-2.6.16.7/arch/mips/boot/Makefile linux-2.6.16.7.new/arch/mips/boot/Makefile
1296 --- linux-2.6.16.7/arch/mips/boot/Makefile 2006-04-17 23:53:25.000000000 +0200
1297 +++ linux-2.6.16.7.new/arch/mips/boot/Makefile 2006-05-04 23:08:18.000000000 +0200
1304 # Drop some uninteresting sections in the kernel.
1305 # This is only relevant for ELF kernels but doesn't hurt a.out
1310 -all: vmlinux.ecoff vmlinux.srec addinitrd
1311 +ZBOOT_TARGETS = zImage zImage.flash
1312 +bootdir-y := compressed
1314 +all: vmlinux.ecoff vmlinux.srec addinitrd zImage
1316 vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX)
1317 $(obj)/elf2ecoff $(VMLINUX) vmlinux.ecoff $(E2EFLAGS)
1323 +.PHONY: $(ZBOOT_TARGETS) $(bootdir-y)
1325 +$(ZBOOT_TARGETS): $(bootdir-y)
1327 +$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
1328 + $(addprefix $(obj)/,$(hostprogs-y))
1329 + $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
1330 diff -urN linux-2.6.16.7/arch/mips/Makefile linux-2.6.16.7.new/arch/mips/Makefile
1331 --- linux-2.6.16.7/arch/mips/Makefile 2006-04-17 23:53:25.000000000 +0200
1332 +++ linux-2.6.16.7.new/arch/mips/Makefile 2006-05-04 23:09:44.000000000 +0200
1333 @@ -831,6 +831,10 @@
1337 +ifdef CONFIG_MIPS_MTX1
1338 +all: vmlinux.srec zImage zImage.flash
1341 vmlinux.bin: $(vmlinux-32)
1342 +@$(call makeboot,$@)
1344 @@ -840,6 +844,12 @@
1345 vmlinux.srec: $(vmlinux-32)
1346 +@$(call makeboot,$@)
1349 + +@$(call makeboot,$@)
1351 +zImage.flash: vmlinux
1352 + +@$(call makeboot,$@)
1354 CLEAN_FILES += vmlinux.ecoff \
1359 @$(MAKE) $(clean)=arch/mips/boot
1360 @$(MAKE) $(clean)=arch/mips/lasat
1361 + @$(MAKE) $(clean)=arch/mips/boot/compressed
1363 CLEAN_FILES += vmlinux.32 \