Howto boot Puppy from internal Compact Flash card

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

Howto boot Puppy from internal Compact Flash card

#1 Post by BarryK »

As discussed in a couple of other threads, there is a problem with booting
Puppy from an internal CF card, that is, plugged onto an IDE cable.
The card is then recognised as a normal ide hard drive, NOT as sda1,
sdb1, etc.

This thread is one in which we are discussing PCs with the VIA passive CPU:
http://www.murga.org/~puppy/viewtopic.p ... 9&start=15

...it has a snapshot of the NTA-6010A that has a VIA Eden 433MHz CPU, with me holding a pci card, and you can see the CF card toward the back. It requires an adaptor to plug onto a standard IDE cable.

The guys at Devon IT preinstalled Puppy v1.0.3 on the CF card, but the installation can be further optimised.

Here is the content of syslinux.cfg as they supplied:

Code: Select all

default vmlinuz root=/dev/ram0 initrd=image.gz
append ide=nodma ramdisk_size=120000 PSLEEP=25 PHOME=sda1 PFILE=pup100-none-262144 PKEYS=us
...they created image.gz with usr_cram.fs, hence needed the "ramdisk_size=" paramter. That works, but is not the most flexible arrangement.
It is preferable to have usr_cram.fs as a separate file.

Here is my modified syslinux.cfg:

Code: Select all

default vmlinuz root=/dev/ram0 initrd=image.gz
append ide=nodma PSLEEP=25 PHOME=hda1 PFILE=pup100-none-262144 PKEYS=us
Notice, ramdisk_size parameter removed, and PHOME changed to hda1.
I don't know about the "ide=nodma", left that in.

Okay, one more thing to fix. I have changed one line in /etc/rc.d/rc.sysinit:

Code: Select all

      #0.9.8 want to minimise writes to usb flash...
      #note, if swapon then have very big ramdisk capacity...
      #is PHOME a usb partition?...
      #v1.0.5 booting from internal CF flash card on IDE cable, will be hdx1, not sdx1,
      #so test PSLEEP instead...
      #if [ ! "`echo "$PHOME" | grep --extended-regexp  "sda|sdb|sdc|sdd"`" = "" ];then
      if [ $PSLEEP -gt 0 ];then #see line220, PSLEEP not defined, gets set =0.
       #what we will consider is mount pupxxx on /mnt/pupxxx by loopback, then copy contents to /root.
       #we need to know that the tmpfs ramdisk has enough space.
       #if not, just drop thru and pupxxx will get mounted directly on /root.
       #RAMDISKFREE will also include any allocated swap...
       RAMDISKFREE=`df | grep "rootfs" | tr -s " " | cut -f 4 -d " "`
       RAMDISKFREE=`expr $RAMDISKFREE - 7000` #leave 7M
       if [ $RAMDISKFREE -gt `du $HOMEDIR/$NAMEPFILE | cut -f 1` ];then
        PUPMNTPOINT="/mnt/pupxxx"
        echo "PUPMNTPOINT=$PUPMNTPOINT" > /tmp/pupxxxshutdown.txt
       fi
      fi      
You can see the commented-out "if" statement, replaced by the one below it.
As PHOME is now hda1, the "if" test doesn't work, so now testing for PSLEEP > 0, which it will be if booting from usb. (the cf card is on the ide cable so is not usb, but still using PSLEEP non-0 value)

So, the steps are, if building from Unleashed:
1. edit /etc/rc.d/rc.sysinit, as above.
2. build with separate usr_cram.fs (the default).
3. When install to usb card, edit syslinux.cfg as above.

You don't necessarily have to use Unleashed, an existing installation could probably be edited by uncompressing and mounting image.gz.

The first time it boots, a file "pup100" will be created on the CF card and it will be mounted on /root.
On subsequent boots, pup100 gets mounted on /mnt/pupxxx/ and contents copied to /root, so as to avoid writes to the Flash memory. As shutdown, /root/ is copied back to /mnt/pupxxx/ hence to pup100.

I have now got the NTA PC saving sessions to CF card, and minimizing writes. As the CF card is 128M, pup100 is only 55M, which is good from the point of view of the RAM, as the PC has 256M RAM, and 55M doesn't use up much of it.
One advantage of having usr_cram.fs separate from image.gz is "/" is now a tmpfs filesystem, which is much easier for the kernel memory manager to handle, and even though "/" is assigned 120M it will only use as much RAM as needed.
Last edited by BarryK on Mon 25 Jul 2005, 13:06, edited 1 time in total.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

Oh yeah, "PSLEEP=25" probably needs to be 25 seconds as the NTA PC has USB 1.1. But a PC with USB 2 could reduce this value, maybe down to PSLEEP=5 or thereabouts.

The NTA PC seems to handle a max resolution of 1024x768, and the Xvesa server only does that at 60Hz.
...that's next on my list, see if we can get a better X server.

Note also, the NTA guys stuck an extra "sleep=10" line just before they mounted usr_cram.fs on /usr, but it doesn't seem to be required.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#3 Post by BarryK »

A short postscript on this:
I've been thinking "inside the square", thinking of the CF card as a usb device, when in fact plugged into an ide cable it isn't.
Which means that we don't need the PSLEEP parameter at all.

However, the way rc.sysinit has been modified in my above post, it is required to get the mechanism of eliminating writes to the CF card during a session.

If we do have PSLEEP, it has to have value of "25" for usb 1.1, as too-low value will cause kernel panic if a usb drive is plugged in.
This is because rc.modules loads "usb-storage" module.

Anyway, the solution given so far does work, but I will finetune rc.sysinit and rc.modules soon, so that we can eliminate that 25 second wait.
Stay tuned.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#4 Post by BarryK »

A suggestion, to avoid the 25 second delay at bootup, is to modify /etc/rc.d/rc.modules like this:

Code: Select all

  if [ $PSLEEP ];then
   #v1.0.5 treat PSLEEP=999 as special case. boot from internal CF card, use PSLEEP
   #test in rc.sysinit for saving writes to flash during session, but as CF isn't
   #an actual usb device when plugged on ide cable, avoid this wait...
   if [ ! $PSLEEP -eq 999 ];then
    echo "Loading kernel usb driver module usb-storage..."
    modprobe usb-storage
    echo "usb storage device replies async, need to sleep $PSLEEP secs..."
    sleep $PSLEEP
   fi
  fi
I have added the extra test for PSLEEP=999. Maybe not the most elegant way of doing it, but it avoids usb-storage from being loaded at boot-time, hence avoids the delay.
PSLEEP is still defined, so utilised later for the test to minimise writes to flash during a session.

User avatar
Marv
Posts: 1264
Joined: Wed 04 May 2005, 13:47
Location: SW Wisconsin

CF shutdown speed

#5 Post by Marv »

Thanks much for the thread above. I had moved from ms-cd to a CF based system (corsair 80x 256Mb CF, 384 Mb ram), and like the folks from Devon, had come close but not quite right. It is now booting very fast, running solidly (still pup 1.03, slow connection..) but is quite slow to shut down as it has to write the whole pupxxx every time.

Is it a total wild hair to use the sessiontimestamp /modified files/ deleted files capabilities from the ms-cd rc files and write to pupxxx only what has been modified or deleted since the last boot? then unmount and zeroize (I need to learn what that is) pupxxx.

If there are no obvious reasons not to try this, I will.

Thanks for Pup!

JM
Pups currently in kennel :D Older LxPupSc and X-slacko-4.4 for my users; LxPupSc, LxPupSc64 and upupEF for me. All good pups indeed, and all running savefiles for look'n'feel only. Browsers, etc. solely from SFS.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#6 Post by BarryK »

Yes, I can't see any reason why you can't modify the shutdown script, and only save new/changed/deleted files/directories, like the multi-session cd does.

Also, you don't have to zeroise the unused space in the pup100 file when shutting down.
-- reason for doing that, is if someone wants to gzip and backup the pup100 file, it will compress more.

User avatar
neg2led
Posts: 5
Joined: Wed 04 May 2005, 09:29
Location: Oz.
Contact:

#7 Post by neg2led »

perhaps you should build up an 'IDE-CF Edition' puppy that does what the Multisession CD does when you shut it down? that would work, no?

doesnt affect me much... would be useful, for later use, but right now i dont need it.


i just use a really really old super extra quiet HDD for pup, its 640mb :D

neg
everyone has fotografic memory. some peoples just dont have films!

User avatar
Marv
Posts: 1264
Joined: Wed 04 May 2005, 13:47
Location: SW Wisconsin

Selective write to pupxxx

#8 Post by Marv »

Attached is a rough first go at a reboot script to write only files modified or added during the current session. It uses Barrys' reboot-cd work and seems fine on my CF system at this point.

As of now, it does not zeroize, does not yet deal with deleted files or do any real size checking of pupxxx. I'll work on some of that after next week when I'm a dwindles slave.

I put it in /.etc/rc.d with the rest of the reboot scripts and cp -af it to /tmp with a line in rc.local overwriting the original rc.reboot copied there by rc.local0.

Advice and work on it welcome as I'm a scriptbaby here.
Attachments
rc.reboot-sel.gz
(2.54 KiB) Downloaded 979 times
Pups currently in kennel :D Older LxPupSc and X-slacko-4.4 for my users; LxPupSc, LxPupSc64 and upupEF for me. All good pups indeed, and all running savefiles for look'n'feel only. Browsers, etc. solely from SFS.

User avatar
Marv
Posts: 1264
Joined: Wed 04 May 2005, 13:47
Location: SW Wisconsin

Sel write NOT useable yet.

#9 Post by Marv »

I have the delete files portion of the above rc.reboot-sel working now, but the final write to pupxxx is commented out as I havent been able to get the cat..sed..awk.. combo to give me the right parameter format to let cp do a copy with directories. For now I am using the Barrys' rc.reboot script with the zeroizing commented out and the shutdown is plenty fast.

Any help on that last step appreciated. This is for ideas only. Sorry it's halfway but I'm off for a week now.
Attachments
rc.reboot-sel.gz
(2.83 KiB) Downloaded 1001 times
Pups currently in kennel :D Older LxPupSc and X-slacko-4.4 for my users; LxPupSc, LxPupSc64 and upupEF for me. All good pups indeed, and all running savefiles for look'n'feel only. Browsers, etc. solely from SFS.

User avatar
dvw86
Posts: 636
Joined: Thu 05 May 2005, 00:55
Location: Washington State

#10 Post by dvw86 »

I have hda1 formated as 3GB FAT16 and hda2 formated as 115GB ext2 with Puppy 1.0.3 installed on it. Grub manages the boot options. I thought that I would try the install to USB script on hda1 just to see how it would work. Everything looks like it installs fine. I modified syslinux.cfg as Barry instructed. Grub finds the vmlinuz file and starts to boot, but half way through booting up on hda1 I get a kernel panic. The error is:
"Warning: unable to open initial console.
Kernel panic: No init found. Try passing init= option to kernel."

Puppy on hda2 still works fine.

wscarl
Posts: 99
Joined: Mon 16 May 2005, 15:22
Location: NY

How to send you hardware?

#11 Post by wscarl »

Barry
Like to send you some hardware. Small - lite - so you can play with IDE Flash Modules - also made short cable so that you have both on one ide header :?: :D How to send you hardware? :?:
Warren

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#12 Post by BarryK »

wscarl,
I've already got the NTA06010A, which has a Compact Flash card plugged in internally via an adaptor to the IDE cable.

wscarl
Posts: 99
Joined: Mon 16 May 2005, 15:22
Location: NY

IDE flash module vs ide flash card

#13 Post by wscarl »

Transend IDE flash module vs ide flash card - ide flash module has longer life for read/write can be set as Master/Save as well as read/write or read only and are avilable 32meg-2gig - 40/44pin. Also it has a low profile.

Agilos

#14 Post by Agilos »

WSCARL: Are the speeds comparable between a flash module and a flash card? Just concerned about a performance difference. Let me know thanks!

User avatar
BlackAdder
Posts: 385
Joined: Sun 22 May 2005, 23:29

#15 Post by BlackAdder »

Perhaps I can add my 2 cents worth.
Transcend quote the instaneous data rate of the IDE flash module at 16.6MB/sec. They also say that it should be good for 100,000 write cycles and they give a 2 year warranty.
There are a number of speeds of CF cards available. Makers have taken to quoting the speed in terms of base CD-ROM speed. So there are 30X, 45X and 80X cards advertised. A 30X is 30 x 150KB/sec or 4.5MB/sec, and I assume that is the instantaneous data rate.
On that basis, the IDE flash module is faster than most CF cards.
The Transcend CF cards are also said to be good for 100,000 write cycles, but some carry a 5 year warranty. Maybe Transcend is expecting the IDE Flash to hit the 100K limit sooner than the CF cards, but that is only my surmise.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#16 Post by Flash »

Here's the Wikipedia article about flash memory. Well worth reading.

Here's another, more in-depth article about flash memory.

wscarl
Posts: 99
Joined: Mon 16 May 2005, 15:22
Location: NY

IDE Flash Modules vs CF-Wait if you got big buck's FLASH HD

#17 Post by wscarl »

IDE FM currently transfer rate of PIO mode 4
While Flash HD are available in IDE ata100, SATA 150and Scsi 160and upto 40gig and in 3.5, 2.5 and 1.8 form factor's

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#18 Post by Flash »

Wow, a 40 GB flash drive? How much does it cost? The largest flash memory I'm aware of is an 8 GB CF card that costs something like $800.

wscarl
Posts: 99
Joined: Mon 16 May 2005, 15:22
Location: NY

FLASH HD

#19 Post by wscarl »

IDE FLASH 40gig 3.5 under $1200.00 USD last I checked- will post current price later.


Post Reply