diff options
Diffstat (limited to 'arch/ppc/boot/openfirmware')
-rw-r--r-- | arch/ppc/boot/openfirmware/Makefile | 96 | ||||
-rw-r--r-- | arch/ppc/boot/openfirmware/coffmain.c | 101 | ||||
-rw-r--r-- | arch/ppc/boot/openfirmware/newworldmain.c | 94 |
3 files changed, 9 insertions, 282 deletions
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile index 83a6433..2a411ec 100644 --- a/arch/ppc/boot/openfirmware/Makefile +++ b/arch/ppc/boot/openfirmware/Makefile @@ -21,26 +21,16 @@ bootlib := $(boot)/lib of1275 := $(boot)/of1275 images := $(boot)/images -OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment -COFF_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \ - -Bstatic CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000 -NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000 COMMONOBJS := start.o misc.o common.o -COFFOBJS := coffcrt0.o $(COMMONOBJS) coffmain.o CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o -NEWWORLDOBJS := crt0.o $(COMMONOBJS) newworldmain.o -targets := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o -COFFOBJS := $(addprefix $(obj)/, $(COFFOBJS)) +targets := $(CHRPOBJS) dummy.o CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS)) -NEWWORLDOBJS := $(addprefix $(obj)/, $(NEWWORLDOBJS)) LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a -HACKCOFF := $(utils)/hack-coff - ifdef CONFIG_SMP END := .smp endif @@ -72,56 +62,11 @@ targets += image.initrd.o $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE $(call if_changed,genimage-initrd) -# Create the note section for New-World PowerMacs. -quiet_cmd_mknote = MKNOTE $@ - cmd_mknote = $(utils)/mknote > $@ -targets += note -$(obj)/note: $(utils)/mknote FORCE - $(call if_changed,mknote) - -$(obj)/coffcrt0.o: EXTRA_AFLAGS := -DXCOFF -targets += coffcrt0.o crt0.o -$(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE +targets += crt0.o +$(obj)/crt0.o: $(common)/crt0.S FORCE $(call if_changed_dep,as_o_S) -quiet_cmd_gencoffb = COFF $@ - cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \ - $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec) -targets += coffboot -$(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE - $(call if_changed,gencoffb) -targets += coffboot.initrd -$(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \ - $(srctree)/$(boot)/ld.script FORCE - $(call if_changed,gencoffb) - - -quiet_cmd_gen-coff = COFF $@ - cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \ - $(HACKCOFF) $@ && \ - ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac - -$(images)/vmlinux.coff: $(obj)/coffboot - $(call cmd,gen-coff) - -$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd - $(call cmd,gen-coff) - -quiet_cmd_gen-elf-pmac = ELF $@ - cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \ - $(NEWWORLDOBJS) $(LIBS) $< && \ - $(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \ - -R .comment $(del-ramdisk-sec) - -$(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \ - $(obj)/note $(srctree)/$(boot)/ld.script - $(call cmd,gen-elf-pmac) -$(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \ - $(LIBS) $(obj)/note \ - $(srctree)/$(boot)/ld.script - $(call cmd,gen-elf-pmac) - quiet_cmd_gen-chrp = CHRP $@ cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \ $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec) @@ -139,46 +84,23 @@ $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \ %-rs6k: % $(call cmd,addnote) -quiet_cmd_gen-miboot = GEN $@ - cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \ - --add-section=$1=$(word 2, $^) $< $@ -$(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz - $(call cmd,gen-miboot,image) - -$(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz - $(call cmd,gen-miboot,initrd) - # The targets used on the make command-line .PHONY: zImage zImage.initrd -zImage: $(images)/vmlinux.coff \ - $(images)/vmlinux.elf-pmac \ - $(images)/zImage.chrp \ - $(images)/zImage.chrp-rs6k \ - $(images)/miboot.image +zImage: $(images)/zImage.chrp \ + $(images)/zImage.chrp-rs6k @echo ' kernel: $@ is ready ($<)' -zImage.initrd: $(images)/vmlinux.initrd.coff \ - $(images)/vmlinux.initrd.elf-pmac \ - $(images)/zImage.initrd.chrp \ - $(images)/zImage.initrd.chrp-rs6k \ - $(images)/miboot.initrd.image +zImage.initrd: $(images)/zImage.initrd.chrp \ + $(images)/zImage.initrd.chrp-rs6k @echo ' kernel: $@ is ready ($<)' TFTPIMAGE := /tftpboot/zImage .PHONY: znetboot znetboot.initrd -znetboot: $(images)/vmlinux.coff \ - $(images)/vmlinux.elf-pmac \ - $(images)/zImage.chrp - cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END) - cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf +znetboot: $(images)/zImage.chrp cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END) @echo ' kernel: $@ is ready ($<)' -znetboot.initrd:$(images)/vmlinux.initrd.coff \ - $(images)/vmlinux.initrd.elf-pmac \ - $(images)/zImage.initrd.chrp - cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END) - cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf +znetboot.initrd:$(images)/zImage.initrd.chrp cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END) @echo ' kernel: $@ is ready ($<)' diff --git a/arch/ppc/boot/openfirmware/coffmain.c b/arch/ppc/boot/openfirmware/coffmain.c deleted file mode 100644 index 2da8855..0000000 --- a/arch/ppc/boot/openfirmware/coffmain.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) Paul Mackerras 1997. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ -#include <linux/string.h> -#include <asm/processor.h> -#include <asm/page.h> - -#include "nonstdio.h" -#include "of1275.h" - -/* Passed from the linker */ -extern char __image_begin, __image_end; -extern char __ramdisk_begin[], __ramdisk_end; -extern char _start, _end; - -extern char image_data[], initrd_data[]; -extern int initrd_len, image_len; -extern unsigned int heap_max; -extern void flush_cache(void *start, unsigned int len); -extern void gunzip(void *, int, unsigned char *, int *); -extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach, - unsigned int progend); -extern void setup_bats(unsigned long start); - -char *avail_ram; -char *begin_avail, *end_avail; -char *avail_high; - -#define SCRATCH_SIZE (128 << 10) - -static char heap[SCRATCH_SIZE]; - -static unsigned long ram_start = 0; -static unsigned long ram_end = 0x1000000; - -static unsigned long prog_start = 0x800000; -static unsigned long prog_size = 0x700000; - -typedef void (*kernel_start_t)(int, int, void *); - -void boot(int a1, int a2, void *prom) -{ - unsigned sa, len; - void *dst; - unsigned char *im; - unsigned initrd_start, initrd_size; - - printf("coffboot starting: loaded at 0x%p\n", &_start); - setup_bats(ram_start); - - initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin); - if (initrd_size) { - initrd_start = (ram_end - initrd_size) & ~0xFFF; - a1 = initrd_start; - a2 = initrd_size; - claim(initrd_start, ram_end - initrd_start, 0); - printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r", - initrd_start, (char *)(&__ramdisk_begin), initrd_size); - memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size); - prog_size = initrd_start - prog_start; - } else - a2 = 0xdeadbeef; - - im = (char *)(&__image_begin); - len = (char *)(&__image_end) - (char *)(&__image_begin); - /* claim 4MB starting at PROG_START */ - claim(prog_start, prog_size, 0); - map(prog_start, prog_start, prog_size); - dst = (void *) prog_start; - if (im[0] == 0x1f && im[1] == 0x8b) { - /* set up scratch space */ - begin_avail = avail_high = avail_ram = heap; - end_avail = heap + sizeof(heap); - printf("heap at 0x%p\n", avail_ram); - printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len); - gunzip(dst, prog_size, im, &len); - printf("done %u bytes\n", len); - printf("%u bytes of heap consumed, max in use %u\n", - avail_high - begin_avail, heap_max); - } else { - memmove(dst, im, len); - } - - flush_cache(dst, len); - make_bi_recs(((unsigned long) dst + len), "coffboot", _MACH_Pmac, - (prog_start + prog_size)); - - sa = (unsigned long)prog_start; - printf("start address = 0x%x\n", sa); - - (*(kernel_start_t)sa)(a1, a2, prom); - - printf("returned?\n"); - - pause(); -} diff --git a/arch/ppc/boot/openfirmware/newworldmain.c b/arch/ppc/boot/openfirmware/newworldmain.c deleted file mode 100644 index fa8a8f9..0000000 --- a/arch/ppc/boot/openfirmware/newworldmain.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) Paul Mackerras 1997. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ -#include <linux/string.h> -#include "nonstdio.h" -#include "of1275.h" -#include <asm/processor.h> -#include <asm/page.h> - -/* Passed from the linker */ -extern char __image_begin, __image_end; -extern char __ramdisk_begin[], __ramdisk_end; -extern char _start, _end; - -extern unsigned int heap_max; -extern void flush_cache(void *start, unsigned int len); -extern void gunzip(void *, int, unsigned char *, int *); -extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach, - unsigned int progend); - -char *avail_ram; -char *begin_avail, *end_avail; -char *avail_high; - - -#define RAM_END (16 << 20) - -#define PROG_START 0x00010000 -#define PROG_SIZE 0x007f0000 - -#define SCRATCH_SIZE (128 << 10) - -typedef void (*kernel_start_t)(int, int, void *); - -void boot(int a1, int a2, void *prom) -{ - unsigned sa, len; - void *dst; - unsigned char *im; - unsigned initrd_start, initrd_size; - - printf("chrpboot starting: loaded at 0x%p\n", &_start); - - initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin); - if (initrd_size) { - initrd_start = (RAM_END - initrd_size) & ~0xFFF; - a1 = initrd_start; - a2 = initrd_size; - claim(initrd_start, RAM_END - initrd_start, 0); - printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r", - initrd_start, (char *)(&__ramdisk_begin), initrd_size); - memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size); - } else - a2 = 0xdeadbeef; - - im = (char *)(&__image_begin); - len = (char *)(&__image_end) - (char *)(&__image_begin); - /* claim 3MB starting at PROG_START */ - claim(PROG_START, PROG_SIZE, 0); - dst = (void *) PROG_START; - if (im[0] == 0x1f && im[1] == 0x8b) { - /* claim some memory for scratch space */ - avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10); - begin_avail = avail_high = avail_ram; - end_avail = avail_ram + SCRATCH_SIZE; - printf("heap at 0x%p\n", avail_ram); - printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len); - gunzip(dst, PROG_SIZE, im, &len); - printf("done %u bytes\n", len); - printf("%u bytes of heap consumed, max in use %u\n", - avail_high - begin_avail, heap_max); - release(begin_avail, SCRATCH_SIZE); - } else { - memmove(dst, im, len); - } - - flush_cache(dst, len); - make_bi_recs(((unsigned long) dst + len), "chrpboot", _MACH_Pmac, - (PROG_START + PROG_SIZE)); - - sa = (unsigned long)PROG_START; - printf("start address = 0x%x\n", sa); - - (*(kernel_start_t)sa)(a1, a2, prom); - - printf("returned?\n"); - - pause(); -} |