diff -ruN /usr/src/linux-2.3.23/arch/sh/boot/Makefile romimage/Makefile --- /usr/src/linux-2.3.23/arch/sh/boot/Makefile Fri Sep 3 20:16:34 1999 +++ romimage/Makefile Thu Nov 11 16:10:22 1999 @@ -6,12 +6,19 @@ # for more details. # +HEAD = head.o +SYSTEM = $(TOPDIR)/vmlinux + +OBJECTS = $(HEAD) + .S.s: $(CPP) $(CFLAGS) $< -o $*.s +#.S.o: +# $(CC) $(CFLAGS) -c $< -o $*.o .S.o: - $(CC) $(CFLAGS) -c $< -o $*.o + $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o -OBJS = +OBJS = # # Drop some uninteresting sections in the kernel. @@ -22,19 +29,34 @@ # # Fake compressed boot # -zImage: $(CONFIGURE) mkboot $(TOPDIR)/vmlinux - $(OBJCOPY) $(strip-flags) $(TOPDIR)/vmlinux zImage.tmp - ./mkboot zImage.tmp zImage - rm -f zImage.tmp +#zImage: $(CONFIGURE) mkboot $(TOPDIR)/vmlinux +# $(OBJCOPY) $(strip-flags) $(TOPDIR)/vmlinux zImage.tmp +# ./mkboot zImage.tmp zImage +# rm -f zImage.tmp -mkboot: mkboot.c - $(HOSTCC) -o $@ $^ +#mkboot: mkboot.c +# $(HOSTCC) -o $@ $^ # Don't build dependencies, this may die if $(CC) isn't gcc dep: clean: rm -f zImage zImage.tmp mkboot + +piggy.o: $(SYSTEM) + tmppiggy=_tmp_$$$$piggy; \ + rm -f $$tmppiggy $$tmppiggy.l nk; \ + $(OBJCOPY) -S -O binary $(SYSTEM) $$tmppiggy; \ + echo "OUTPUT_FORMAT(\"elf32-shl\", \"elf32-shl\", \"elf32-shl\") OUTPUT_ARCH(sh) ENTRY(_start) SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk;\ + $(LD) -r -o piggy.o -b binary $$tmppiggy -T $$tmppiggy.lnk; \ + rm -f $$tmppiggy $$tmppiggy.lnk \ + tmppiggy=_tmp_$$$$piggy; \ + echo "OUTPUT_FORMAT(\"elf32-shl\", \"elf32-shl\", \"elf32-shl\") OUTPUT_ARCH(sh) SECTIONS { .image : { image_len = 0x10000; image_data = .; *(.data) image_data_end = .; }}" > $$tmppiggy.lnk;\ + $(LD) -r -o image.o -b binary root-fs-image -T $$tmppiggy.lnk; \ + rm -f $$tmppiggy.lnk + +zImage: piggy.o $(OBJECTS) image.o + $(LD) -T boot.lds -e __start -o vmlinux $(OBJECTS) piggy.o image.o dummy: diff -ruN /usr/src/linux-2.3.23/arch/sh/boot/boot.lds romimage/boot.lds --- /usr/src/linux-2.3.23/arch/sh/boot/boot.lds Thu Jan 1 01:00:00 1970 +++ romimage/boot.lds Mon Nov 1 22:02:38 1999 @@ -0,0 +1,107 @@ + +OUTPUT_FORMAT("elf32-shl", "elf32-shl", "elf32-shl") + +OUTPUT_ARCH(sh) +ENTRY(_start) + +SECTIONS +{ + . = 0xA0000000 + 0x04000000 + 0x0000; + __text = .; /* Text and read-only data */ + _text = .; /* Text and read-only data */ + .text : { + *(.empty_zero_page) + *(.text) + *(.fixup) + *(.gnu.warning) + } = 0 + .text.lock : { *(.text.lock) } /* out-of-line lock text */ + .rodata : { *(.rodata) } + .kstrtab : { *(.kstrtab) } + + . = ALIGN(16); /* Exception table */ + ___start___ex_table = .; + ___ex_table : { *(__ex_table) } + ___stop___ex_table = .; + + ___start___ksymtab = .; /* Kernel symbol table */ + ___ksymtab : { *(__ksymtab) } + ___stop___ksymtab = .; + + __etext = .; /* End of text section */ + + .data : { /* Data */ + *(.data) + CONSTRUCTORS + } + + __edata = .; /* End of data section */ + + . = ALIGN(8192); /* init_task */ + .data.init_task : { *(.data.init_task) } + /* stack */ + .stack : { _stack = .; __stack = .; } + + . = ALIGN(4096); /* Init code and data */ + ___init_begin = .; + .text.init : { *(.text.init) } + .data.init : { *(.data.init) } + . = ALIGN(16); + ___setup_start = .; + .setup.init : { *(.setup.init) } + ___setup_end = .; + ___initcall_start = .; + .initcall.init : { *(.initcall.init) } + ___initcall_end = .; + . = ALIGN(4096); + ___init_end = .; + + . = ALIGN(4096); + .data.page_aligned : { *(.data.idt) } + + . = ALIGN(32); + .data.cacheline_aligned : { *(.data.cacheline_aligned) } + + . = ALIGN(4); + ___bss_start = .; /* BSS */ + .bss : { + *(.bss) + } + . = ALIGN(4); + __end = . ; + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging section are relative to the beginning + of the section so we begin .debug at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff -ruN /usr/src/linux-2.3.23/arch/sh/boot/head.S romimage/head.S --- /usr/src/linux-2.3.23/arch/sh/boot/head.S Thu Jan 1 01:00:00 1970 +++ romimage/head.S Thu Nov 11 16:10:33 1999 @@ -0,0 +1,91 @@ +/* + * arch/sh/kernel/boot/head.S + * + * Copyright (C) 1999 Ludovic LANGE + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ +#include + +/* + * + */ +ENTRY(_start) + !----------------------------------- + !mov.l L_initserial, r0 ! Initialisation of serial port + !jsr @r0 ! + !nop ! + !mov #'.',r4 !LLA + !mov.l L_putDebugChar,r0 !LLA + !jsr @r0 !LLA + !nop !LLA + !----------------------------------- + + !---------------- First move the vmlinux from ROM to RAM ----------------------- + + mov.l 1f,r0 ! r0 := input_data + mov.l 2f,r1 ! r1 := input_data_end + mov.l L_ezp,r2 ! r2 := address in RAM where we start +9: + mov.l @r0+,r3 ! move 4 bytes data [r0] to r3, r0 += 4 + mov.l r3,@r2 ! move r3 to [r2] + nop ! + add #4,r2 ! r2 += 4 + cmp/hs r1,r0 ! if (r0 >= r1 ), true + bf/s 9b ! while (r0 < r1) + nop ! + ! r2 : end of kernel / start of image + + !---------------- Then 'patch' the kernel with values for the filesystem offset in memory ----- + + mov.l ram_img2,r2 ! r2 := 'offset' of 'address in RAM where we start' in page 0 + mov.l L_ezp, r0 !empty zero page + add #0x10, r0 !initrd start + mov.l r2, @r0 !initrd start + add #4, r0 !initrd len + mov.l img_len, r1 ! size of filesystem image + mov.l r1, @r0 ! + nop ! + + !---------------- Then move filesystem from ROM to RAM ------------------------ + + mov.l img_start,r0 ! r0 := image_data + mov.l img_end,r1 ! r1 := image_data_end + mov.l ram_img,r2 ! r2 := address in RAM where we put the filesystem +8: + mov.l @r0+,r3 ! move 4 bytes data [r0] to r3, r0 += 4 + mov.l r3,@r2 ! move r3 to [r2] + nop ! + add #4,r2 ! r2 += 4 + cmp/hs r1,r0 ! if (r0 >= r1 ), true + bf/s 8b ! while (r0 < r1) + nop ! + + !------------------ Last start the kernel by jumping to its entry point ----------------- + + mov.l 5f,r0 ! r0 := kernel entry point + jmp @r0 ! jump to it + nop ! + + .balign 4 +1: .long input_data ! Start of Kernel data in ROM, put here by the linker +2: .long input_data_end ! End of Kernel data in ROM, put here by the linker +3: .long input_len ! Length of Kernel data in ROM, put here by the linker +!========================================= USER MODIFICATION STARTS HERE ========================================= +!L_ezp: .long SYMBOL_NAME(empty_zero_page) +L_ezp: .long 0x8C001000 ! Start of your Kernel in RAM. Must be value of symbol empty_zero_page. +!5: .long SYMBOL_NAME(_stext) +5: .long 0x8C002000 ! Entry point of your kernel in RAM. Hard-coded, is the value of : _stext +img_len: .long 0x80000 ! Size of your initrd image +ram_img: .long 0x8C800000 ! Start of your initrd image in RAM. Hard coded, choose it in the RAM region of linux +ram_img2: .long 0x00800000 ! Start of your initrd image, expressed in page 0. same value of: (ram_img2 & 0x00FFFFFF) +!========================================= USER MODIFICATION ENDS HERE =========================================== +L_initserial: .long SYMBOL_NAME(init_serial) +!L_putDebugChar: .long SYMBOL_NAME(putDebugChar) +!L_putlong: .long SYMBOL_NAME(debug_putlong) +!L_dump: .long SYMBOL_NAME(debug_hexdump) +img_start: .long image_data ! Start of your initrd image in RAM, put here by the linker +img_end: .long image_data_end ! End of your initrd image, put here by the linker Binary files /usr/src/linux-2.3.23/arch/sh/boot/root-fs-image and romimage/root-fs-image differ