EmbeddedRelated.com
Forums

u-boot and root filesystems

Started by Unknown June 1, 2006
Hi,

I have some questions about u-boot for a project I'm working on. The uP
is an ARM9.

I am wondering if it's possible to use u-boot to two things in one
boot-up:
- to create a root filesystem on an SD card (I'm not interested in the
secure digital functionality)
- to boot Linux using a Linux kernel image from inside this newly
created root filesystem

Another question is how small can a functional rootfs be? I am hoping I
can get it under 20 MB.

And a final question is: Is it possible to have a read-only filesystem?
Or do some things (ie. /dev devices) have to be read/write?

Thanks, Pete

psommerfeld@gmail.com wrote:
> Hi, > > I have some questions about u-boot for a project I'm working on. The uP > is an ARM9. > > I am wondering if it's possible to use u-boot to two things in one > boot-up: > - to create a root filesystem on an SD card (I'm not interested in the > secure digital functionality) > - to boot Linux using a Linux kernel image from inside this newly > created root filesystem > > Another question is how small can a functional rootfs be? I am hoping I > can get it under 20 MB.
You can have a bare bone system in 8M or so. But there is not much you can do other than starting a custom app.
> > And a final question is: Is it possible to have a read-only filesystem? > Or do some things (ie. /dev devices) have to be read/write?
No, /dev can be read-only, but /tmp amd /var must be writable.
> > Thanks, Pete
linnix wrote:
> No, /dev can be read-only, but /tmp amd /var must be writable.
But can be resident in a mounted ramdisk. I'm about to go down this path also, after painstakingly wiring an IDE cable to a CF socket so I can boot Linux from CF on a PC/104 P133.
linnix wrote:
> psommerfeld@gmail.com wrote: >> Hi, >> >> I have some questions about u-boot for a project I'm working on. The >> uP is an ARM9. >> >> I am wondering if it's possible to use u-boot to two things in one >> boot-up: >> - to create a root filesystem on an SD card (I'm not interested in the >> secure digital functionality)
You can use U-boot to store a file system, not to create it. Whether you can use your specific ARM9 or not is depending on if u-boot supports the SD-interface on your chip. If it doesn't then you have to write a driver.
>> - to boot Linux using a Linux kernel image from inside this newly created >> root filesystem
May beed modifications to U-boot, but I know of people that have done such modifications.
>> Another question is how small can a functional rootfs be? I am >> hoping I can get it under 20 MB. > > You can have a bare bone system in 8M or so. But there is not much > you can do other than starting a custom app. >
You can have a complete system with Linux kernel and small file system in 4 MB but you would have very little room for your own application
>> And a final question is: Is it possible to have a read-only >> filesystem? Or do some things (ie. /dev devices) have to be >> read/write? > > No, /dev can be read-only, but /tmp amd /var must be writable.
Yes, in a way, if you use a RAM disk, then the underlying flash image is not writable.
> >> >> Thanks, Pete
-- Best Regards, Ulf Samuelsson ulf@a-t-m-e-l.com This message is intended to be my own personal view and it may or may not be shared by my employer Atmel Nordic AB
psommerfeld@gmail.com wrote:

> I have some questions about u-boot for a project I'm working on. The uP > is an ARM9.
In answer to most of your questions, please refer to <http://www-128.ibm.com/developerworks/library/pa-migrate2/> which is an article I wrote last year on related topics. It is irksome to run Linux off a write-protected root filesystem. Possible, yes - with tweaking - but it's much easier just to load the root filesystem into a RAMdisk and run entirely out of RAM. Faster, too. As far as memory footprint goes, are you asking about flash storage requirements or RAM requirements? You can fit a fully functional Linux distribution and applications into 8Mb without difficulty. (The root filesystem can be compressed, remember. I've implemented turnkey x86-based Linux devices on a 4Mb CompactFlash). I would suggest 64Mb RAM, more if you intend to use X. It can be squeezed into less, but again it's irritating.
larwe wrote:
> I've implemented turnkey x86-based Linux devices on a 4Mb CompactFlash).
Did you use VFAT on the CF or a Linux FS? With which bootloader?
Clifford Heath wrote:

> > I've implemented turnkey x86-based Linux devices on a 4Mb CompactFlash). > > Did you use VFAT on the CF or a Linux FS? With which bootloader?
Semantic gripe: "VFAT" is the name of a Microsoft filesystem driver. The media format is FAT12, FAT16, or FAT32. I used FAT (12, on such a small card) and SYSLINUX as the loader. A strong side benefit of this approach is that the kernel and rootfs are simply DOS-readable files. This means that inexperienced end-users can put the card into a PC, copy across two new files, and the upgrade is complete.
larwe wrote:
> Semantic gripe: "VFAT" is the name of a Microsoft filesystem driver.
Ok, it's wrong that linux "mount" uses "-t vfat" then.
> ...inexperienced end-users can put the card into a PC
Yes, I thought that was the most sensible way to do it also. Thanks for the confirmation.
Clifford Heath wrote:

> > Semantic gripe: "VFAT" is the name of a Microsoft filesystem driver. > > Ok, it's wrong that linux "mount" uses "-t vfat" then.
The Linux kernel vfat driver is so named because it is compatible with the LFN support in current versions of the Microsoft VFAT driver. The Microsoft driver was originally introduced in Windows for Workgroups 3.11, at which time it was a VxD. When Win95 was released, this VxD was rolled into the master VMM32 VxD under the name "vfat", "Virtual FAT Driver" and LFN support was added. This is a semantic issue but I am old and curmudgeonly, and expected to be colorful.
larwe wrote:
> psommerfeld@gmail.com wrote: > > > I have some questions about u-boot for a project I'm working on. The uP > > is an ARM9. > > In answer to most of your questions, please refer to > <http://www-128.ibm.com/developerworks/library/pa-migrate2/> which is > an article I wrote last year on related topics. > > It is irksome to run Linux off a write-protected root filesystem. > Possible, yes - with tweaking - but it's much easier just to load the > root filesystem into a RAMdisk and run entirely out of RAM. Faster, > too. > > As far as memory footprint goes, are you asking about flash storage > requirements or RAM requirements? You can fit a fully functional Linux > distribution and applications into 8Mb without difficulty. (The root > filesystem can be compressed, remember. I've implemented turnkey > x86-based Linux devices on a 4Mb CompactFlash). I would suggest 64Mb > RAM, more if you intend to use X. It can be squeezed into less, but > again it's irritating.
There are no set rules for flash vs. ram. Very often, it's a trade off between costs and limitations. Nowadays, flash is sometimes cheaper than ram. There are still many systems with limited ram space, but flash is virtually unlimited. You can compress everything on flash, but need more ram to decompress and run them anyway.