public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Re: [Bootldr] cramfs/jffs2 bootloader code
  2001-06-19 20:19 cramfs/jffs2 bootloader code Russ Dill
@ 2001-06-19 20:18 ` Tim Riker
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Riker @ 2001-06-19 20:18 UTC (permalink / raw)
  To: Russ Dill; +Cc: bootldr, linux-mtd

Does this include the changes on:

http://www.wearablegroup.org/software/bootldr/

which add jffs, jffs2, ymodem, etc to the crl bootldr?

I'm about to release tftpboot from CF ether patches for blob to Erik.

Russ Dill wrote:
> 
> OK, the cramfs/jffs2 bootloader code is finally more or less complete.
> 
> These modules allow a bootloader to load a kernel from multiple sources
> (ie cramfs, jffs, straight from flash etc). It always load the file
> "/linux" right now. Currently included are modules for cramfs, jffs2 and
> zImage straight from flash. Currently, the interface is:

-- 
Tim Riker - http://rikers.org/ - short SIGs! <g>
All I need to know I could have learned in Kindergarten
... if I'd just been paying attention.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* cramfs/jffs2 bootloader code
@ 2001-06-19 20:19 Russ Dill
  2001-06-19 20:18 ` [Bootldr] " Tim Riker
  0 siblings, 1 reply; 2+ messages in thread
From: Russ Dill @ 2001-06-19 20:19 UTC (permalink / raw)
  To: bootldr, linux-mtd

[-- Attachment #1: Type: text/plain, Size: 3115 bytes --]

OK, the cramfs/jffs2 bootloader code is finally more or less complete.

These modules allow a bootloader to load a kernel from multiple sources
(ie cramfs, jffs, straight from flash etc). It always load the file
"/linux" right now. Currently included are modules for cramfs, jffs2 and
zImage straight from flash. Currently, the interface is:

struct kernel_loader {
        
        /* Return true if there is a kernel contained at src */
        int (* check_magic)(struct part_info *part);
        
        /* load the kernel from the partition part to dst, return the
number
         * of bytes copied if successful, zero if not */
        u32 (* load_kernel)(u32 *dst, struct part_info *part);

        /* A brief description of the module (ie, "cramfs") */
        char *name;
};


The bootloader can cycle through the available modules until it finds
one with a matching kernel, at which point it attempts to load the
kernel by that message.

There is a test/ directory for testing the different modules from user
space with debug messages, note that the erasesize is hardcoded.

For the decompressors to function at a decent speed, your bootloader
should enable the i-cache and set flash timings properly. The modules
were written around blob, but should be easily inserted into any
boot_loader, the only file needing specific editing for the boot loader
is load_kernel.c (and possibly some types.h issues).

Example code for within the bootloader below:

void load_kernel(blobStatus *status)
{
        int i;
        unsigned long size;
        struct part_info part;
        
        part.erasesize = MAIN_BLOCK_SIZE;
        part.size = KERNEL_LEN;
        part.offset = (char *) KERNEL_START;
        for (i = 0; loader[i] && !loader[i]->check_magic(&part); i++);
        if (!loader[i]) {
                SerialOutputString("unable to find kernel, loading raw "
                                   "data and hoping for the
best!\rloading");
                size = KERNEL_LEN;
                MyMemCpy((u32 *)KERNEL_RAM_BASE,
                 (u32 *)KERNEL_START, size >> 2);
                
        } else {
                SerialOutputString("loading kernel from ");
                SerialOutputString(loader[i]->name);
                if ((size = loader[i]->load_kernel((u32
*)KERNEL_RAM_BASE,                      
                     &part)) == 0) {
                        SerialOutputString(" error loading kernel!\r");
                        return;
               }
        }
        SerialOutputString("loaded 0x");
        SerialOutputHex(size);
        SerialOutputString(" bytes\r");
        status->kernelSize = size;
        status->kernelType = fromFlash;
}


Current issues (release early, release often)

the cramfs module doesn't follow symlinks when looking for /linux (jffs2
*does* follow symlinks though)

future ideas:

if we can load the kernel from a fs image, why not other things, like a
config, with bootloader parameters (whether or not to load a ramdisk,
etc) as well as append= parameters for the kernel.

I'll also email a patch against blob-1.0.8-pre2 on the lart list.

[-- Attachment #2: load_kernel.tar.bz2 --]
[-- Type: application/octet-stream, Size: 18615 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-19 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-19 20:19 cramfs/jffs2 bootloader code Russ Dill
2001-06-19 20:18 ` [Bootldr] " Tim Riker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox