Skip to contentSkip to conversation

Mounting JFFS2, Bootloader

DISCUSSION Daniel Belz 4 participants 7 messages Jul 11, 2002 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,

I have a proprietary board with the MPC860 processor.
For this board, I have a ROM Startup code that lives in a 256k Atmel flash chip (is my BIOS). This code initialize
the needed features, read a "boot sector" from a compact flash (just for check some integrity) and read a linux kernel and a ramdisk from previous defined locations.
This works fine, but I like to change this schema to
support the JFFS2 file system.
For this, I like to mantain my ROM startup code, modifying just the process that load the kernel and ramdisk. The process must load a bootloader (something like lilo) that allow
read a configuration file from the JFFS partition, choose a kernel to boot from a list or boot from network.
I'm studing various codes from different bootloaders, and i think that this isn't very complex. The most complex task is support the JFFS2.
To do this, i like to solve some doubts:
1 - How i do to mount the JFFS2 without before load the kernel? 2 - I need mount the JFFS2 to read files from them, or I can read files from the partition without mount them?
3 - When I mount the partition: on startup of the BL or just when I need to read something?
4 - Which are the steps to mount the FS? Which functions are needed call to do this?
5 - Which files I need to include in the software?
6 - Someone have a sample code that explain these process?

I like to known some opinions and hints to do this!

PS.: I don't like to use the PPCBoot!!!

Tanks

Signature · 5 lines
------------------------------------------------- 
 Daniel Belz           [email protected]
 Cyclades Brasil       R&D 
 Sao Paulo - Brazil    +55 (11) 5033-3393
---------------------------------------
#1 lore raw
Quoted 1 line · Daniel Belz

PS.: I don't like to use the PPCBoot!!!

May I ask why? It sure would save you a lot of work... Anyway, if you don't want to use PPCboot, you can always rip out and use it's JFFS support routines.

Regards,
Marius

-----------------------------------------------------------------------------

Marius Groeger           SYSGO Real-Time Solutions GmbH     [email protected]
Software Engineering     Embedded and Real-Time Software    www.sysgo.de
Voice: +49-6136-9948-0   Am Pfaffenstein 14                 www.osek.de
FAX:   +49-6136-9948-10  55270 Klein-Winternheim, Germany   www.elinos.com
#2 lore raw

Hi,

Quoted 8 lines · Marius Groeger
Quoted 1 line · Daniel Belz

PS.: I don't like to use the PPCBoot!!!

May I ask why? It sure would save you a lot of work... Anyway, if you don't want to use PPCboot, you can always rip out and use it's JFFS support routines.

I need somthing more simple, and I like to use the existent code for board init.
I think to use the JFFS2 support from PPCB, but i can't separate the JFFS2 code
from the boards support. And have the kernel parameters...

Quoted 9 lines

Regards,
Marius

-----------------------------------------------------------------------------

Marius Groeger           SYSGO Real-Time Solutions GmbH     [email protected]
Software Engineering     Embedded and Real-Time Software    www.sysgo.de
Voice: +49-6136-9948-0   Am Pfaffenstein 14                 www.osek.de
FAX:   +49-6136-9948-10  55270 Klein-Winternheim, Germany   www.elinos.com

Tanks

Signature · 5 lines
------------------------------------------------- 
 Daniel Belz           [email protected]
 Cyclades Brasil       R&D 
 Sao Paulo - Brazil    +55 (11) 5033-3393
-------------------------------------------------
#3 lore raw
Quoted 11 lines · Daniel Belz

Hi,

Quoted 8 lines · Marius Groeger
Quoted 1 line · Daniel Belz

PS.: I don't like to use the PPCBoot!!!

May I ask why? It sure would save you a lot of work... Anyway, if you don't want to use PPCboot, you can always rip out and use it's JFFS support routines.

Quoted 5 lines

I need somthing more simple, and I like to use the existent code for board init.
I think to use the JFFS2 support from PPCB, but i can't separate the JFFS2 code
from the boards support. And have the kernel parameters...

a number of bootloaders (including blob) already do this, assuming you are using GPL, just grab that code, if you aren't using GPL? too bad

#4 lore raw
In reply to Daniel Belz

Having recently done the same kind of thing (on a different board), I think I can help.

Exactly what you need depends a bit on how you want to handle this. If you are happy with a bootstrap that can only handle one kernel, then it's really easy: You hardcode the path/filename of the kernel into the bootloader, and then walk the filesystem looking for this file. If you want more flexibility than that, you may instead need to look for a configuration file and then process the configuration file.

JFFS2 has a really easy to work with on-device layout, so it shouldn't take much effort to locate the files you're interested in.

The files you'll need to work with are in fs/jffs2 and include/linux.

Figure out exactly what capabilities you want first though. That'll make it much easier to plan out. And remember, if it's being done in the bootloader, you're not in the kernel, so you may have to reimplement some things.

Signature · 4 lines
-------------------------------------------------
Justin Wojdacki        
[email protected]         (408) 350-5032
Communications Processors Group -- Analog Devices
#5 lore raw

Hi,

Quoted 3 lines · Justin Wojdacki

Having recently done the same kind of thing (on a different board), I think I can help.

...

Quoted 3 lines

If you want more flexibility than that, you may instead need to look for a configuration file and then process the configuration file.

Yes, i need something like this, as an application to be loaded instead of the
kernel. Simple, to allow load for more than one option from flash or from network
(simple tftp). I don't need write on the flash (CF) at this time.

Quoted 9 lines

JFFS2 has a really easy to work with on-device layout, so it shouldn't take much effort to locate the files you're interested in.

The files you'll need to work with are in fs/jffs2 and include/linux.

Figure out exactly what capabilities you want first though. That'll make it much easier to plan out. And remember, if it's being done in the bootloader, you're not in the kernel, so you may have to reimplement some things.

Ok, but which is the "entry point" of the JFFS, that is, i need to call the
functions to mount, or i can treat like a mounted file system, and just read
the needed files?
And, I can read from a CompactFlash card, if i'm using (after boot) the MTD
emulation? The CF is mapped as a hd device.

Quoted 6 lines

--
-------------------------------------------------
Justin Wojdacki
[email protected] (408) 350-5032
Communications Processors Group -- Analog Devices

Signature · 5 lines
------------------------------------------------- 
 Daniel Belz           [email protected]
 Cyclades Brasil       R&D 
 Sao Paulo - Brazil    +55 (11) 5033-3393
-------------------------------------------------
#6 lore raw
Quoted 11 lines · Daniel Belz
Quoted 10 lines

JFFS2 has a really easy to work with on-device layout, so it shouldn't take much effort to locate the files you're interested in.

The files you'll need to work with are in fs/jffs2 and include/linux.

Figure out exactly what capabilities you want first though. That'll make it much easier to plan out. And remember, if it's being done in the bootloader, you're not in the kernel, so you may have to reimplement some things.

Quoted 6 lines

Ok, but which is the "entry point" of the JFFS, that is, i need to call the functions to mount, or i can treat like a mounted file system, and just read the needed files? And, I can read from a CompactFlash card, if i'm using (after boot) the MTD emulation? The CF is mapped as a hd device.

The "entry point" of the JFFS is defined by the map you create for the flash device. Take a look at drivers/mtd/maps to get an idea of what's going on. Basically you'll lay out the flash, telling the kernel what parts it can and can't touch. You'll assign one or more parts of that map to be JFFS2 partitions, one of which is the root partition. Then, in your bootstrap, you'll walk through flash, starting at the base of that root paritition until you've found and loaded all the data for the kernel. I do that stage in a few passes, but it's not hard to do.

I can't help you on the compact flash side though. I'm not familiar with that technology. If the bootloader has to do any modification of the CF card/interface, then it should reset it to the base state the kernel is expecting, before booting the kernel.

Signature · 4 lines
-------------------------------------------------
Justin Wojdacki        
[email protected]         (408) 350-5032
Communications Processors Group -- Analog Devices