From: Russ Dill <Russ.Dill@asu.edu>
To: bootldr@handhelds.org, linux-mtd@lists.infradead.org
Subject: cramfs/jffs2 bootloader code
Date: Tue, 19 Jun 2001 13:19:30 -0700 [thread overview]
Message-ID: <3B2FB3D2.44047FCF@asu.edu> (raw)
[-- 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 --]
next reply other threads:[~2001-06-19 20:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-19 20:19 Russ Dill [this message]
2001-06-19 20:18 ` [Bootldr] cramfs/jffs2 bootloader code Tim Riker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3B2FB3D2.44047FCF@asu.edu \
--to=russ.dill@asu.edu \
--cc=bootldr@handhelds.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox