LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2004, 09:15 AM   #16
pmarques
LQ Newbie
 
Registered: Jul 2003
Posts: 28

Rep: Reputation: 15

I really think that the approach "compress everything, unpack at boot" vs "use the flash as if it were a disk" depends on the problem we are trying to solve.

For an embedded system, that performs only one task, the "uncompress to RAM" approach is great, because you can never cause filesystem corruption. Every time you turn on the device, the same data gets loaded into RAM, and it's like you said "newborn"

If you are trying to run some standard application, in a "workstation like" environment, where applications expect that changes to /etc will be kept, files written to ~/.something will be there the next time, etc., you probably want to use the flash as a standard disk.

There are options in between, as you mentioned. For instance, I developed a small distro (10Mb total space occupied) that as two squashfs files mounted loopback onto /bin and /usr/lib, so that all binaries are compressed.
SquashFS compresses much better than cramfs. The only problem is that it is still not in the official kernel, so you have to patch the kernel to get it working.
You can even have the root filesystem read-only from a cramfs (or squashfs) partition and then mount another partition with a standard filesystem (ext3, etc.), and use the mount --bind to have /home, /etc, mapped onto directories inside that partition (so that they share the total available space)

There are a million options. That is what makes Linux great
 
Old 02-03-2004, 09:57 AM   #17
mafiltenborg
Member
 
Registered: Jan 2004
Location: Denmark
Distribution: Debian, Debian, Debian
Posts: 81
Blog Entries: 3

Rep: Reputation: 19
Awesome!

Man, i can't wait to get this baby going!

Thanks for everything - for now When i run face first into a brick wall, i'll be back
 
Old 02-03-2004, 10:55 AM   #18
chrisplinux
LQ Newbie
 
Registered: Jul 2003
Posts: 27

Rep: Reputation: 15
Do any of you see anything different being needed if you wanted to do the same thing off of a 128 MB USB Thumbdrive? My motherboard will support Thumbdrive booting but I was always trying to make the Thumbdrive a Linux Boot Disk with Syslinux and have the actual drives as additional partitions on the M$ drives. RH9 said it would work but didn't. I always figured it was because the kernel needed USB support built it.

What do you think?

Chris
/dev/geek
 
Old 02-03-2004, 11:26 AM   #19
enine
Senior Member
 
Registered: Nov 2003
Distribution: Slackware 14.2, SlackwareArm-current
Posts: 1,203
Blog Entries: 4

Rep: Reputation: 183Reputation: 183
I am running a linux distro from CF. One of the problems I ran into was making the cf bootable. With the CF inside a PCMCIA-CF or a USB - CF adapter neither lilo or grub would install since those don't show up in the systems BIOS as ide drives. My solution was to use an IDE-CF adapter, plug into a MB with a cd-rom on the other ide channel and boot off a slackware cd and install like normal (I had a 128M cf, 16M will be a bit more difficult as you have to leave more out). Next step was to edit the script in the /etc folder and comment out the line where the root partition is remounted as read/write. Then create a ram drive and some scripts to touch some files there and then symlink varios files to those in the ram drive. I have a pretty complete non-gui slack system booting un under 30 seconds from power on with mpg123 working.
 
Old 02-03-2004, 11:29 AM   #20
pmarques
LQ Newbie
 
Registered: Jul 2003
Posts: 28

Rep: Reputation: 15
A long time ago I tried to do this, but ran into a small problem.

The BIOS loaded LILO, that load the kernel, but the kernel didn't detect the USB drive in time to mount it as the root filesystem. (and complained there was no root device just before the message from the usb core detected the drive)

The solution would be to create a small initrd (maybe using nash) that waits a little until the pen appears and then switch the root filesystem to the pen.

I didn't gave it another try, but I'm pretty sure it would work, it was just not on my extensive todo list
 
Old 02-03-2004, 11:46 AM   #21
pmarques
LQ Newbie
 
Registered: Jul 2003
Posts: 28

Rep: Reputation: 15
Hi, enine

You can actually install LILO into a CF card on a USB adapter.

What you have to do is build a "special" lilo.conf to tell LILO everything he needs:

> disk=/dev/sda
> bios=0x80
>
> boot=/dev/sda
>
> map=/mnt/disk/boot/map
>
> install=/mnt/disk/boot/boot.b
> lba32
> compact
> image=/mnt/disk/boot/vmlinuz
> label=linux
> root=/dev/hda1

This configuration assumes that the adapter appear as /dev/sda, and the boot partition is already mounted on /mnt/disk, and that on the target system the CF card will appear as the IDE primary master.

Notice the "bios=0x80" line. This tells LILO that, although he can't figure out now where the BIOS thinks the device is, if he tells the BIOS later to load from device 0x80 it will work.

To install a standard distro, if you have enough space on a CF card, the easiest way IMHO would be to use a IDE<->CF adapter and install as usual.

However, if you don't have enough space, you can always try to install to a standard IDE drive, then use that drive as a slave on some other machine, delete what you don't want, compress what you can, and then copy the result onto the flash (maybe tar/untar the result is saffer) and run lilo to make it bootable.
 
Old 02-03-2004, 11:50 AM   #22
enine
Senior Member
 
Registered: Nov 2003
Distribution: Slackware 14.2, SlackwareArm-current
Posts: 1,203
Blog Entries: 4

Rep: Reputation: 183Reputation: 183
So I have to have a seperate lilo config from the one I'm currtly running on? I assume there is a way to tell lilo to look at that other config file for the install
 
Old 02-03-2004, 11:58 AM   #23
pmarques
LQ Newbie
 
Registered: Jul 2003
Posts: 28

Rep: Reputation: 15
Yes, "lilo -C config_file"

LILO defaults to "/etc/lilo.conf" if no option is provided. However you can have a lot more configuration files to install the bootloader in different setups (I have about 5 files hanging around in my disk).
The man page for LILO describes this much better. I know it is a little extensive, but if you're playing with setting drives for booting somewhere else, it is worth reading
 
Old 02-03-2004, 12:01 PM   #24
enine
Senior Member
 
Registered: Nov 2003
Distribution: Slackware 14.2, SlackwareArm-current
Posts: 1,203
Blog Entries: 4

Rep: Reputation: 183Reputation: 183
IIRC I think I tried that. I seem to remember trying to point it to /mnt/cf/etc/lilo so maybe with the proper config it would have worked. I got it bootable then plug it back in my laptop and edit/change things from there.
 
Old 02-03-2004, 11:48 PM   #25
wartstew
Member
 
Registered: Apr 2002
Location: Albuquerque, NM USA
Distribution: Slackware, Ubuntu, Debian, Maemo
Posts: 464

Rep: Reputation: 30
Re: CF memory wear countermeasures

Quote:
Originally posted by mafiltenborg
To get better endurance, one might do a complete copy-to-ramdisk of the entire root-filesystem
Yes, most floppy based mini-Linuxes work this way. I guess it all depends on if you have RAM to spare.

Quote:
which as far as i can see, can be stored in a compressed state on flash.
This way, flash-size can be significantly reduced (rootfs now stored in a compressed state), leaving room to buy more RAM and thus maintain unit cost.
Yes, but you can also compress root file systems that are only to be mounted "read only" by using things like "cloop" like Lnx-bbc, Knoppix-Linux, and the many distos based on Knoppix does.

Quote:
Only penalty i can see, is the added time required to unpack the rootfilesystem into RAM.
This usually isn't too bad depending on the power of the processor you are using. Most of these compression schemes are such that they are time consuming to compress but fast to uncompress.

Quote:
Or am i all wrong when i have this view of things:
Compressed kernel stored at the beginning of CF-memory, unpacking itself (at boottime) to RAM, followed by
Kernel-driven unpacking of compressed rootfilesystem - also into RAM.
Go!
No, people do this kind of thing all the time. Learn about "initrd" and Linux ramdisks.

Quote:
This way, running OS & software may write all they wish, doing no harm to the flash since writing is done to the ramdisk-based rootfilesystem.

Indirect benefit: Everytime the device is powered on, it has no memory of the past. It's like newborn
But the same is true if you mount the root file system Read-only.

Quote:
Should any NV logging be needed, one may mount part of the flash as a disk and do logging onto that.
And wear out that part of the disk ...

Actually what you might to is have a special "diagnostic" or "debug" mode where you turn logging on only when you are trying to track down a problem.
 
Old 02-06-2004, 06:13 PM   #26
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
this thread has been quiet for a few days, but since the quest was for something that fits into 16MB, you could start with my bootable "Roll your own" CD project at
http://www.phenix.bnl.gov/~purschke/RescueCD/

It is geared towards making a customized boot CD with no frills, and it makes the / file system from a compressed image. If you don't need much, you can bring the whole thing down to < 16MB (the pre-made cd image that's on that page has 13MB).

There's a script that does it all for you if you do a CD; if you have the recipe to make the same for a stick you'll see how to do it.

(I haven't been able to do it because I have no machine that's capable of booting from a stick - if you get it done please let us know how it went).

Hope it helps,

mlp
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
486DX 16Mb How to install DSL? Merlyn Linux - Laptop and Netbook 14 07-04-2005 04:41 PM
Smartcard/Flash card reader (usb storage device) Redhat 9 i0scanw Linux - Newbie 0 10-19-2003 06:43 PM
pci usb2 card and mass storage. Er how??? BashTin Linux - Hardware 2 10-17-2003 07:34 PM
help£”:who knows how to use flash storage? iamthewind Linux - Software 6 10-10-2003 03:29 PM
zaurus sl5500 and flash memory usb storage devices boomshak Linux - Hardware 2 11-23-2002 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration