From: <bob...@us...> - 2007-07-14 01:17:43
|
Revision: 1144 http://svn.sourceforge.net/hackndev/?rev=1144&view=rev Author: bobofdoom Date: 2007-07-13 18:17:37 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Cocoboot: Removed initrd relocation (suggested by phire) By 4k-aligning the image as we load it from the memory card we no longer need to relocate the image in the ARM, instead we can just leave it where the m68k code left it. Hopefully this will reduce the chance of errors due to images overlapping. Modified Paths: -------------- cocoboot/trunk/Changelog cocoboot/trunk/arm/boot.c cocoboot/trunk/m68k/imgloader.c cocoboot/trunk/m68k/mainform.c Modified: cocoboot/trunk/Changelog =================================================================== --- cocoboot/trunk/Changelog 2007-07-13 21:53:03 UTC (rev 1143) +++ cocoboot/trunk/Changelog 2007-07-14 01:17:37 UTC (rev 1144) @@ -1,3 +1,5 @@ + - Removed initrd relocation for speed and reliability (suggested by phire) + version 0.3: - Added overflow-buffer as last resort to allocation problem (slapin's idea) - Cleaned up treo code (removed all #ifdefs) Modified: cocoboot/trunk/arm/boot.c =================================================================== --- cocoboot/trunk/arm/boot.c 2007-07-13 21:53:03 UTC (rev 1143) +++ cocoboot/trunk/arm/boot.c 2007-07-14 01:17:37 UTC (rev 1144) @@ -24,9 +24,11 @@ #define MACH_TYPE_T3XSCALE 829 #define TAG_OFFSET 0x100 -#define INITRD_OFFSET 0x0400000 -#define T3_INITRD_OFFSET 0x1500000 +UInt32 make_4k_aligned(UInt32 addr) +{ + return addr + 0x1000 - (addr & 0xfff); +} static void jump_to_kernel(void *kernel_base, UInt32 tag_base, UInt32 mach) { @@ -84,7 +86,6 @@ if(!kernel || !cmdline) { return 0xc0ffee; } - UInt32 initrd_offset; /* since we're going to turn off the MMU, we need to translate * all out pointers to physical addresses. @@ -101,6 +102,13 @@ return 0xbadc01a; } + /* force our pointers to be 4k aligned, imgloader will have shifted + * the image forward. + */ + kernel = (void*) make_4k_aligned((UInt32)kernel); + if (initrd) + initrd = (void*) make_4k_aligned((UInt32)initrd); + /* that includes the stack pointer ... */ asm volatile ("mov %0, sp" : "=r"(vstack) ); pstack = (void *)virt_to_phys(g, (UInt32) vstack); @@ -176,21 +184,10 @@ setup_xscale_cpu(); } - if (pg->mach_num==MACH_TYPE_T3XSCALE){ - initrd_offset=T3_INITRD_OFFSET; - } else { - initrd_offset=INITRD_OFFSET; - } - /* place kernel parameters in memory */ setup_atags(pg->ram_base + TAG_OFFSET, pg->ram_base, pg->ram_size, cmdline, - pg->ram_base + initrd_offset, initrd_size); + initrd, initrd_size); - /* copy initrd into place */ - if (initrd) { - copy_image((void*)(pg->ram_base + initrd_offset), initrd, initrd_size); - } - /* bring on the penguin! */ jump_to_kernel(kernel, pg->ram_base + TAG_OFFSET, pg->mach_num); Modified: cocoboot/trunk/m68k/imgloader.c =================================================================== --- cocoboot/trunk/m68k/imgloader.c 2007-07-13 21:53:03 UTC (rev 1143) +++ cocoboot/trunk/m68k/imgloader.c 2007-07-14 01:17:37 UTC (rev 1144) @@ -56,6 +56,9 @@ err = VFSFileOpen(vol_ref, name, vfsModeRead, &f); if(err != errNone) return -2; + /* ensure the image is 4k aligned. */ + offset = 0x1000 - (((UInt32)buffer) & 0xfff); + VFSFileReadData(f, size, buffer, offset, &bytes_read); VFSFileClose(f); @@ -151,7 +154,7 @@ } } else { /* vfs */ - return load_file(name, vol_ref, size, buffer, 0); + return load_file(name, vol_ref, size, buffer, 0x0); } out_unlock: Modified: cocoboot/trunk/m68k/mainform.c =================================================================== --- cocoboot/trunk/m68k/mainform.c 2007-07-13 21:53:03 UTC (rev 1143) +++ cocoboot/trunk/m68k/mainform.c 2007-07-14 01:17:37 UTC (rev 1144) @@ -202,7 +202,7 @@ vol = search_image(name, loc, sizeof(loc), &size); if(vol < -1) goto out; - ftr_size = size; + ftr_size = size + 0x1000; /* allocate an extra 4k so we can align the image */ while (ftr_size) { if(!(err=FtrPtrNew (CREATOR_ID, FEATURE_NUM + n, ftr_size, image))) { break; @@ -372,7 +372,7 @@ cmdline_p = FrmGetObjectPtr(form, FrmGetObjectIndex(form, CommandLine)); cmdline_th = MemHandleNew(size); cmdline_tp = MemHandleLock(cmdline_th); - StrCopy(cmdline_tp, "init=/linuxrc root=/dev/mmcblk0p2"); /* default value */ + StrCopy(cmdline_tp, " "); /* default value */ //PrefGetAppPreferences ('CcBt', 1, cmdline_tp, &size, true); MemHandleUnlock(cmdline_th); FldSetTextHandle(cmdline_p, cmdline_th); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |