From: Alessandro R. <ru...@gn...> - 2001-11-23 10:40:39
|
>> That should work. If you or someone else is interested in my >> implementation, I'll post the real code and script tomorrow. > > Yes, please. Ok. This morning I managed to populate my ramdisk and boot, it works fine, however the SCIF interrupts are not registered so I can't send input to my shell (I only see SCI in /proc/interrupts). This is because I use SCIF as console, and is independent of the ramdisk problem. BTW: can someone please point me to a libc suited for cross-compiling? Building one is tedious, and with the available packages I only managed to compile with horrible -I and -L arguments to the target, but only statical linking was possible. Thanks. Like you, I have no full-featured boot loader, yet. I boot via an eprom tailoerd for vxworks and I can only load a single ELF file from disk. At the end you find the short patch that I used to make initrd work. To convert the ramdisk to object file, use this Makefile: all: ramdisk.o cp $^ linux/arch/sh/boot ramdisk.o: ramdisk.gz sh4eb-linux-ld -r -T ramdisk.lds -b binary \ -o $@ $^ ramdisk.gz: ramdisk gzip < $^ > $@ ramdisk.lds is here: OUTPUT_FORMAT("elf32-shbig-linuxs") OUTPUT_ARCH(sh) SECTIONS { .data : { __rd_start = .; *(.data) __rd_end = .; } } The patch does what I described last time, plus it disables freeing the ramdisk because it isn't aligned (I know it can be aligned somehow, I just didn't go further on that path), so such freeing released valuable memory as well and the kernel locked hard right after mounting the fs; most likely because some allocation overwritten valuable data. Please note that the patch uses a new CONFIG option for the platform we are using. It's pretty dirty stuff, but it works fine to boot with a single file if you can't do anything else. --- ./arch/sh/kernel/Makefile.orig Thu Nov 22 02:04:17 2001 +++ ./arch/sh/kernel/Makefile Thu Nov 22 02:05:07 2001 @@ -23,6 +23,8 @@ obj-$(CONFIG_SH_RTC) += rtc.o obj-$(CONFIG_SH_DMA) += dma.o obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o +obj-$(CONFIG_BLK_DEV_INITRD) += ../boot/ramdisk.o + ifeq ($(CONFIG_PCI),y) ifeq ($(CONFIG_SH_DREAMCAST),y) --- ./arch/sh/kernel/setup.c.orig Thu Nov 22 02:08:16 2001 +++ ./arch/sh/kernel/setup.c Thu Nov 22 02:18:05 2001 @@ -438,6 +438,15 @@ reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE); #ifdef CONFIG_BLK_DEV_INITRD +#ifdef CONFIG_SH_GX8TSU + { + extern void * __rd_start, * __rd_end; + + initrd_start = (unsigned long)&__rd_start; + initrd_end = (unsigned long)&__rd_end; + initrd_below_start_ok = 1; + } +#else if (LOADER_TYPE && INITRD_START) { if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { reserve_bootmem_node(NODE_DATA(0), INITRD_START+__MEMORY_START, INITRD_SIZE); @@ -452,6 +461,7 @@ initrd_start = 0; } } +#endif /* GX8TSU */ #endif #if 0 --- ./arch/sh/mm/init.c.orig Thu Nov 22 16:04:36 2001 +++ ./arch/sh/mm/init.c Thu Nov 22 16:05:32 2001 @@ -193,6 +193,7 @@ #ifdef CONFIG_BLK_DEV_INITRD void free_initrd_mem(unsigned long start, unsigned long end) { +#if 0 /* GX8 tmp hack */ unsigned long p; for (p = start; p < end; p += PAGE_SIZE) { ClearPageReserved(virt_to_page(p)); @@ -201,6 +202,7 @@ totalram_pages++; } printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); +#endif } #endif |