Booting and running with CF card in IDE adaptor (Solved)

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
playdayz
Posts: 3799
Joined: Fri 25 Apr 2008, 18:57

Booting and running with CF card in IDE adaptor (Solved)

#1 Post by playdayz »

Is anyone interested in how Puppy determines that it is booting from a CF (flash card) in an IDE adaptor? I am interested because that is what I have, a Sandisk Extreme IV 4GB in an Addonics CF to IDE adaptor. Everything works great except that Puppy doesn’t seem to be able to distinguish this CF/IDE (ideflash) arrangement from a physical hard disk (idehd) no matter what I do. At least I don’t think it does. The reason I am interested is that I understand that Puppy will minimize writes to a flash disk but not to a physical hard disk.

The funny thing about this, is that the Addonics CF to IDE plus the Sandisk is supposed to look and behave exactly like a physical hard disk—and it does. I’ve installed XP-SP2 and Mandriva 2008 and both installed and ran with no problems, just as with a physical disk. Puppy does too, except for the writes (which may even be a bogus issue with an advanced card like the Sandisk IV???).

I installed Puppy 3.01 with the CF card in IDE adaptor option from the Universal Installer. It installed and ran perfectly (it installed as with a CD with extlinux, etc, instead of Grub). In /etc/rc.d/PUPSTATE the PUPMODE=12 and the pmedia=ideflash. I was told in a question in the Newbie Forum that with a CF card in an IDE adaptor the PUPMODE should be 13, and that makes sense from looking at the documentation (the +1 comes from mounting a third layer and not writing pup_sav.2fs directly to the disk in real time). This seems like a separate, more advanced problem so I am introducing it here (I have tried to avoid any typos ;-)

I can also install with the Hard Disk option. That installs with Grub in the MBR and the PUPMODE=12 and pmedia=idehd. From the two installs, it looks like maybe pmedia is set at install time—but that PUPMODE is determined while booting???

Elsewhere in the docs I have seen that pfix=nodma is recommended for CF cards in IDE (and also for usbflash). Maybe that is a clue because the Sandisk IV is a “udma
Last edited by playdayz on Tue 29 Apr 2008, 23:21, edited 1 time in total.

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#2 Post by HairyWill »

I think I have isolated the problem code in init

Code: Select all

#do we want a tmpfs top unionfs layer?...
#only if pup_save (or PDEV1 for DEV1PUP=yes, or first boot) on a flash drive, usb or internal...
case $PUPMODE in
 4) #so far have only got a pup_xxx.sfs. this is first boot or pfix=ram.
  PUPMODE=5 #`expr $PUPMODE + 1` #yes, want tmpfs top layer (PUPMODE=5).
  ;;
 12) #4=pup_xxx.sfs found, 8=pup_save.2fs found.  total=12
  DRVSAVE="`echo -n "$PUPSAVE" | cut -b 1-3`"
  REMOVABLEDRVSAVE="`cat /sys/block/$DRVSAVE/removable`"
  [ "$REMOVABLEDRVSAVE" = "1" ] && PUPMODE=13 #`expr $PUPMODE + 1`
  ;;
I suspect that your device has a zero in /sys/block/$DRVSAVE/removable I'm guessing that on your system it is either /sys/block/sda/removable or /sys/block/hda/removable. If this is the case then I am amazed that no-one else with an ideflash install has had a similar problem. It would seem much safer to test the PMEDIA variable as well to determine what pupmode should be set. I also imagine that there are some people that might be willing to trust the inbuilt wear leveling on their flash controller in exchange for getting immediate writes. If you can confirm what you get for

Code: Select all

cat /sys/block/hda/removable
we can see if we can patch init to work properly. If you want to edit init then PizzasGood gives instructions here: http://www.murga-linux.com/puppy/viewto ... 357#187357or a can send you a patched initrd.gz for you to try tomorrow.

<edit>this has been reported before http://www.murga-linux.com/puppy/viewtopic.php?t=26800 so you are not the only one affected </edit>
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
playdayz
Posts: 3799
Joined: Fri 25 Apr 2008, 18:57

Determining PUPMODE for some CF to IDE Adaptors (Solved)

#3 Post by playdayz »

Yes, that's it. It works.

There was a 0 in cat /sys/block/hda/removable

I followed pizzasgood's instructions to edit the initrd.gz.

I used this patch because I thought it was less easy for me to misunderstand.

http://www.murga-linux.com/puppy/viewtopic.php?t=13430
Find the following line of
Code:

case $PUPMODE in

then add before it this line of
Code:

PUPMODE=13
When I rebooted the first thing I saw was a new icon on the desktop--the target that says SAVE. Then I checked /etc/X11/PUPSTATE and sure enough we had a PUPMODE of 13.

Well, the first time I rebooted I had a PUPMODE of 5, then when I quit and saved I booted in 13.

This has been great fun guys, please let me know if I can be of use testing for CF cards or other patches for this condition etc. I am very tenacious ;-) Thanks much for your time.

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#4 Post by HairyWill »

Excellent.
That will work for you but not as a generic solution as it hardcodes PUPMODE=13
For future puppy releases I recommend the following as a patch the line at the bottom checks the state of the PMEDIA boot parm

Code: Select all

 12) #4=pup_xxx.sfs found, 8=pup_save.2fs found.  total=12
  DRVSAVE="`echo -n "$PUPSAVE" | cut -b 1-3`"
  REMOVABLEDRVSAVE="`cat /sys/block/$DRVSAVE/removable`"
  [ "$REMOVABLEDRVSAVE" = "1" ] && PUPMODE=13 #`expr $PUPMODE + 1`
[ "$PMEDIA" = "ideflash" ] && PUPMODE=13
  ;;
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

won't boot if I tell it PMEDIA=ideflash

#5 Post by mcewanw »

I haven't tried modifying initrd.gz as yet, but have simply tried putting PMEDIA=ideflash on my menu.lst kernel line.
Unfortunately, it won't then boot: says it can't find the pup_400.sfs file
If I use PMEDIA=usbflash it boots fine.
You can find my full menu.lst contents here:

http://www.murga-linux.com/puppy/viewtopic.php?t=29580

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

booting from flash drive on Classmate

#6 Post by mcewanw »

Hairy Will wrote:If you want to edit init then PizzasGood gives instructions here: http://www.murga-linux.com/puppy/viewto ... 357#187357
I couldn't get the Intel Classmate to boot Puppy Dingo at all with PMEDIA=ideflash, so I just used PMEDIA=usbflash and modified initrd.gz to:

Code: Select all

 12) #4=pup_xxx.sfs found, 8=pup_save.2fs found.  total=12
  DRVSAVE="`echo -n "$PUPSAVE" | cut -b 1-3`"
  REMOVABLEDRVSAVE="`cat /sys/block/$DRVSAVE/removable`"
  [ "$REMOVABLEDRVSAVE" = "1" ] && PUPMODE=13 #`expr $PUPMODE + 1`
PUPMODE=13
  ;;
i.e. on the last line above, I forced $PUPMODE to 13 should it otherwise have been 12. So, if no pup_save file created, the system still starts off booting to PUPMODE 5.
That worked for me; now I get the big SAVE icon on the desktop and so on.

I guess it might have been better to make the last line:
[ "$PMEDIA" = "usbflash" ]
since then I'd have some control over it, but I haven't tried that. Don't know why PMEDIA=ideflash wouldn't boot at all or I would have used Hairy Will's suggestion.

magerlab
Posts: 739
Joined: Sun 08 Jul 2007, 20:08

#7 Post by magerlab »

is there a way to change init to force looking for puppyfiles or modem if we know that all the files are on eee's ssd and there's no modem present
or no version upgrade?

thank you

Post Reply