XP & Puppy dual boot from usb or SD without menu.lst

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

XP & Puppy dual boot from usb or SD without menu.lst

#1 Post by greengeek »

.
Do you have a netbook or laptop with an inbuilt HDD installation of Windows XP? Would you like to be able to choose whether to boot into XP, or into Puppy, without making any changes to the HDD at all?

You can do this by setting up a usb stick to control the booting, and the original setting up of this stick can even be done on a completely different machine (or even using a live Puppy CD), so that you do not risk your XP installation at all.

ETP has developed a way to achieve this here:
http://www.murga-linux.com/puppy/viewtopic.php?t=79955
and focuses on using XP to do the preparation of the usb stick that handles the dual boot. However, I really wanted to prepare the dualboot stick using only a Puppy environment, so this method is a result of my trial and error following ETPs method and the wiki tutorials he linked to.

Stick preparation only takes five minutes - the longest part is reading my blurb.

This procedure uses a running Puppy installation to create a usb stick or SD card which is capable of dualbooting a PC (or netbook) from it’s inbuilt HDD Win XP installation, or from the frugal puppy on the stick/SD. It does not alter the XP installation in any way. It does not add anything to c:/ drive or modfiy the boot sector on the HDD at all. This method does not require a menu.lst. The boot configuration is kept inside the syslinux.cfg file.


*** Note 1 *** This method relies on the use of syslinux 4.04. These specific files have been created by ETP for use with 4.04 and it is known that they will not work with other versions of syslinux, so the usb stick needs to be prepared following the instructions laid out below. I have made a small change to ETP’s original syslinux.cfg file in order to remove one parameter that specified sdb1 as the .sfs location - I suffered a kernel panic if this parameter failed to match the actual location given to the usb stick at boot time, so I removed it as suggested on ETP’s thread.
*** Note 2 *** I am not an expert at these things, so I have simply recorded the steps in the way that gave me reliability and reproducibility. I am sure there are more succint ways of going about it.


NOTE: ALL DATA ON THE USB STICK OR SD CARD WILL BE LOST!!

1) Obtain a suitable usb stick (or SD card) which contains no important data. I trialled this with a 4GB usb stick and a 2GB SD card. (I am planning on getting a Lexar Echo ZX or Sandisk Cruzer “Fit
Attachments
Booting on Acer netbook_.JPG
(29.99 KiB) Downloaded 1464 times
Last edited by greengeek on Sun 15 Jun 2014, 04:43, edited 14 times in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#2 Post by greengeek »

Contents of original post (Included here to retain continuity of other contributors comments below):
(This procedure DOES work, but it involves using one mistake to correct another :-). Still worth a go if using the method in the first post fails for you)
.
Do you have a netbook or laptop with an inbuilt HDD installation of Windows XP? Would you like to be able to choose whether to boot into XP, or into Puppy, without making any changes to the HDD at all?

ETP has developed a way to achieve this here:
http://www.murga-linux.com/puppy/viewtopic.php?t=79955
and focuses on using XP to do the preparation of the usb stick that handles the dual boot. However, I really wanted to prepare the dualboot stick using only a Puppy environment, so this method is a result of my trial and error following ETPs method and the wiki tutorials he linked to.

Stick preparation only takes five minutes - the longest part is reading my blurb.

This procedure uses a running Puppy installation to create a usb stick or SD card which is capable of dualbooting a PC (or netbook) from it’s inbuilt HDD Win XP installation, or from the frugal puppy on the stick/SD. It does not alter the XP installation in any way. It does not add anything to c:/ drive or modfiy the boot sector on the HDD at all. This method does not require a menu.lst. The boot configuration is kept inside the syslinux.cfg file.


*** Note 1*** This method relies on the use of syslinux 4.04. These specific files have been created by ETP for use with 4.04 and it is known that they will not work with other versions of syslinux, so the usb stick needs to be prepared following the instructions laid out below. I have made a small change to ETP’s original syslinux.cfg file in order to remove one parameter that specified sdb1 as the .sfs location - I suffered a kernel panic if this parameter failed to match the actual location given to the usb stick at boot time, so I removed it as suggested on ETP’s thread.
***Note 2*** I am not an expert at these things, so I have simply recorded the steps in the way that gave me reliability and reproducibility. I am sure there are more succint ways of going about it.


NOTE: ALL DATA ON THE USB STICK OR SD CARD WILL BE LOST!!

1) Obtain a suitable usb stick (or SD card) which contains no important data. I trialled this with a 4GB usb stick and a 2GB SD card. (I am planning on getting a Lexar Echo ZX or Sandisk Cruzer “Fit
Last edited by greengeek on Sat 03 Nov 2012, 01:40, edited 2 times in total.

User avatar
Monsie
Posts: 631
Joined: Thu 01 Dec 2011, 07:37
Location: Kamloops BC Canada

XP & Puppy dual boot from usb or SD without menu.1st

#3 Post by Monsie »

Hi greengeek,

I noticed you repeated a step.
Type: cd syslinux404/mbr
Type: dd conv=notrunc bs=446 count=1 if=mbr.bin of=/dev/sdxx [Take care that you have specified the correct drive number] (This writes the mbr correctly) Close the terminal.

4) (This is a repeat of step 2 but do it again now because the mbr rewrite will have altered the partition format...) This step formats and partitions the stick:
As far as I know, the reason you set the block size=446 in your dd command is so that your master boot record re-write won't interfere with the partition table, the latter of which is set in: blocks 447-512 That being the case, then a repeat of step 2 is not necessary.

Hope this helps,
Monsie
My [u]username[/u] is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Re: XP & Puppy dual boot from usb or SD without menu.1st

#4 Post by greengeek »

Monsie wrote:Hi greengeek, I noticed you repeated a step.
Thanks Monsie - the odd thing is that if I omit that extra step the partition formatting is gone and the stick won't mount.

Not sure if that indicates a hardware peculiarity or software thing, but I tried many times and found it wouldn't work unless I used Gparted for the second time. I've tried this on several usb sticks, several SD and micro SD cards, and two netbooks and always seemed to need the repeat step. As long as I follow the script it seems to work.

Heres a pic of the second netbook booting from micro SD card and running a boot splash kindly sent to me by ETP (inverted and modified to fit the menu)
Attachments
beakersplash.JPG
(22.16 KiB) Downloaded 1424 times

User avatar
Monsie
Posts: 631
Joined: Thu 01 Dec 2011, 07:37
Location: Kamloops BC Canada

XP & Puppy dual boot from usb or SD without menu.1st

#5 Post by Monsie »

Hi greengeek,

Hmmm....

Well, I went to the Wiki article over here regarding the Master Boot Record and it looks like I am behind the times... :oops:

The info I gave you is correct in that it refers to the older, traditional specs for mbr. It looks to me, that the number of blocks for the bootstrap code has changed to either bs=440 or possibly bs=428 and it seems to reflect a change in addressing (LBA) vis a vis the hardware, and also a change in specs regarding the boot loader vis a vis the operating system, and whether Advanced Active Partioning was being used. What this means is that the old spec of bs=446 while not writing to the partition table, would interfere with it given the re-allocation of space in the new spec... and so you would have to repeat Step 2 in order to partition and format your drive. So I think it is both "a hardware peculiarity or software thing" as you have speculated.

I am sure that you would want to test this, and I would be inclined to try the block size @ 440 bytes first:

Code: Select all

dd conv=notrunc bs=440 count=1 if=mbr.bin of=/dev/sdxx
If it works, then of course you will have saved yourself a step :wink:

Hope this helps, and I would be interested in knowing how you make out...

Monsie
My [u]username[/u] is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Re: XP & Puppy dual boot from usb or SD without menu.1st

#6 Post by greengeek »

Monsie wrote:The info I gave you is correct in that it refers to the older, traditional specs for mbr. It looks to me, that the number of blocks for the bootstrap code has changed to either bs=440 or possibly bs=428 and it seems to reflect a change in addressing (LBA)
Hi Monsie, in putting together the tutorial I had many questions about what the correct syntax and order of events should be - and I must say the answers I found were (annoyingly) somewhat varied. Some info suggested that the partitioning should be done BEFORE the mbr is written, and some said AFTER. Some indicated the bs=446 was correct, and some suggested bs=440. I went for the 446 since it seemed to be the most common (ok - not a very good reason necessarily...)

I’m probably going to stick with the 446 until I understand the info that suggests otherwise (ok that understanding might be very slow in coming...)

Anyway, I have done some testing based on your suggestion and come up with the following info:

1) It doesn’t seem to matter which "normal" value I set for bs=xxx, it always destroys the partition information, requiring Gparted to be run again. (However, in my testing I found that any value of bs that is equal to or below 11 leaves the partition info intact - 12 or more takes away the partition info, but 11 or less is fine - not that this helps anything but curious anyway)

2) This dd command that I am using to write the mbr returns info about the number of bytes that is written to the mbr. One might expect that if you set a parameter of bs=446 that 446 bytes would be written, but that seems not to be the case all the time. The number of bytes written does not always equal the bs number. For example, using syslinux version 4.04, bs=446 only writes 440 bytes (as does any number higher than 440. Any number below 440 will write the actual number selected)

3) The number of bytes actually written varies depending on the version of syslinux used.
Here is the raw data I captured:

syslinux404
bs=446 lost partition info (copied 440Bytes)
bs=440 lost partition info (copied 440 bytes)
bs=438 lost partition info (copied 438 bytes)
bs=428 lost partn info (copied 428 bytes)

syslinux373
bs=446 lost partn info copied 404 bytes
bs=440 lost partn info copied 404 bytes
bs=428 lost partn info copied 404 bytes
bs=400 lost partn info copied 400 bytes
bs=260 lost partn info copied 260 bytes
bs=60 lost partn info copied 60 bytes
bs=20 lost partn info copied 20 bytes
bs=12 lost partn info copied 12 byes
bs=11 retained partn info. copied 11 bytes
bs=10 retained partn info copied 10 bytes
bs=2 retained partn info. copied 2 bytes

syslinux301
bs=446 still lost partition info (but only copied 304 bytes)
bs=440 still lost partition info (copied 304 bytes)
bs=428 still lost partition info (copied 304 bytes)

I also tried with lba set or unset and I did not see any clear difference from those tests - except that sometimes when lba was set I found that pmount could not see the drive, whereas it could if lba was not set.

The structure of the mbr is annoyingly variable so I doubt I will ever understand it - but it seems to me that understanding all aspects of how the mbr has evolved is key to getting usb boots to work properly. It just takes so darned long to trial everything.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#7 Post by 01micko »

Hmmm..

I used

Code: Select all

cat mbr.bin >/dev/sdx
That was after installing extlinux, but I wouldn't think it would be any different with syslinux [not sure]. No reformat was needed.

Might be worth trying.
Puppy Linux Blog - contact me for access

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#8 Post by greengeek »

01micko wrote:I used

Code: Select all

cat mbr.bin >/dev/sdx
Thanks, it seems that "cat" gives me exactly the same results. Here are the results after running the cat command (upon a newly Gparted drive) - pic 1 shows that pmount detects the drive sdc1 (as long as lba is not set), but pic 2 shows that pmount is not happy to mount the drive when I click it's "mount" button. Pic 3 shows that pmount is unable to detect the drive when lba is set, and pic 4 shows that after the "cat" Gparted no longer sees a FAT32 partition.
(I should mention that when I click on the drive icon on the desktop the pmount dialog never normally shows up - after a normal Gparted clicking the drive icon simply opens a window that shows an empty drive. However, if the partition info has been lost, clicking the drive icon launches pmount - so thats when I know I have a problem) (All this config/testing has been done with Slacko 5.3 if that makes any difference - I haven't upgraded to the latest yet)
Attachments
1_cat pmount detect no lba.jpg
(74.12 KiB) Downloaded 1323 times
2_cat pmount mount error no lba.jpg
(18.93 KiB) Downloaded 1284 times
3_cat pmount cant detect lba set.jpg
(31.52 KiB) Downloaded 1304 times
4_cat gparted FAT gone.jpg
(29.46 KiB) Downloaded 1308 times

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#9 Post by 8-bit »

This discussion shows formatting the flash drive with gparted as fat 32.
I have formatted flash drives as a linux type such as ext2 or ext 3 and been able to have them boot with grub written to that device.
So my question is why one would have to mix the partition type of fat32 with a linux file system.
It seems that preparing the flash drive as completely linux including the file system would work.

User avatar
Monsie
Posts: 631
Joined: Thu 01 Dec 2011, 07:37
Location: Kamloops BC Canada

XP & Puppy dual boot from usb or SD without menu.lst

#10 Post by Monsie »

greengeek, I feel some of your pain & frustration.... There's a lot of information out there regarding booting various devices under various circumstances, and it is confusing at times to say the least. That said, you deserve much credit for all of the time & effort put in with the testing you've done. 8)

At this point, I too am confused with the problems with re-writing the mbr... it doesn't seem to make a lot of sense, so I want to leave that for now. :?

I have some other thoughts, questions that I want to raise... in the spirit of trying to figure some stuff out here, then maybe we can all learn from our exchange of ideas...:D

It seems to me that when using gparted or similar partition manager that one can wipe the data while leaving the mbr intact. Further, if one is able to set the boot flag okay, then the mbr must be intact, because the flag is simply an instruction to use the existing mbr vis a vis any additional boot loader being deployed. (I haven't tested this, but I suspect that if the mbr was corrupt, then an error message would pop up to indicate that the boot flag cannot be set...) If this is the case, then you should be able to go from Step 2 --> Step 5 in order to set up your boot loader and system files.

Now there are definitely times when the mbr does get messed up, or overwritten, and so obviously then it must be restored. In such scenario, it seems to me that the easiest thing to do would be to replace the entire master boot record and not just part of it (or 440 out of 512 bytes) to something like:

Code: Select all

dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdxx
I'm thinking the overall steps should be in the following order:
  • re-install the mbr --if necessary
    partition and format the drive
    set up the boot loader and system files
With this approach, it seems to me that one should not have to repeat any steps.

Just some more food for thought,
Monsie
My [u]username[/u] is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.

User avatar
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

XP & Puppy dual boot from usb or SD without menu.lst

#11 Post by ETP »

8-bit wrote:This discussion shows formatting the flash drive with gparted as fat 32.
I have formatted flash drives as a linux type such as ext2 or ext 3 and been able to have them boot with grub written to that device.
So my question is why one would have to mix the partition type of fat32 with a linux file system.
It seems that preparing the flash drive as completely linux including the file system would work.
Hi 8-bit,

By definition this thread is targeted at XP users. (Who do not wish to change their XP setup in any way.) It is convenient for them (when in XP) to have the stick formatted as fat32 so that they can read & write to it without installing any extra utility to do so within XP. The same logic is applied in bootflash & the PUI where depending on the size of the removable device, it is formatted as fat16 or fat32

Users totally comfortable with Linux may well opt to format a stick as say EXT4 and use grub or EXTLINUX to make it bootable. A more versatile option is perhaps to divide the stick into two partitions fat32 & ext4. Such an ext4 partition is handy for symlinks and compiling. If the main sfs & savefile are placed on that partition you can also benefit from a modicum of extra boot speed over fat32.
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Re: XP & Puppy dual boot from usb or SD without menu.lst

#12 Post by greengeek »

Monsie wrote:it seems to me that the easiest thing to do would be to replace the entire master boot record and not just part of it (or 440 out of 512 bytes) to something like:

Code: Select all

dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdxx
Hi Monsie, the dd syntax you have suggested without the bs parameter etc (and also the cat idea suggested by o1micko) seems to give the same result as my original syntax, but does look a lot tidier, so I shall do some testing with that and make my tutorial a little cleaner. Given that I am emphasisng that the usb stick should contain no valuable data there seems to be no reason to do anything other than a complete mbr write as you have suggested. (I am not aiming to preserve anything - just setting up a fresh/known state in the stick)

The main reason for me running Gparted BEFORE rewriting of the mbr is that some usb sticks do not show up on the desktop if their formatting is dodgy. Even if the icon does not show up on the desktop (or is not seen by pmount) gparted will generally see the stick and allow the (inexperienced) user to see which sdx number has been allocated. If they then proceed with the gparted partitioning the drive icon appears on the desktop and they can have confidence in naming the correct drive in the mbr.bin syntax.

That being said, my preferred order of actions would therefore be:

Run Gparted to set up a single FAT32 partition that has the boot flag set
Download and extract syslinux 4.04 into folder /syslinux404
cd syslinux404/mbr
dd if=mbr.bin of=/dev/sdxx
Run Gparted again to set up the single FAT32 partition with boot flag set
cd syslinux404/linux
./syslinux -i /dev/sdxx
Set up boot and grub folders, add special boot files and puppy frugal files.

That looks a bit tidier so i shall put on my testing gloves and give it a whirl.

User avatar
OscarTalks
Posts: 2196
Joined: Mon 06 Feb 2012, 00:58
Location: London, England

#13 Post by OscarTalks »

greengeek wrote:after the "cat" Gparted no longer sees a FAT32 partition.
Were you using the command?:-

Code: Select all

cat mbr.bin >/dev/sdc1
If so, should that not be without the number on the end (boot sector, not partition)? eg:-

Code: Select all

cat mbr.bin >/dev/sdc
Apologies if I misunderstood your post.

@ETP or anybody

I have managed to make my SD card bootable with extlinux and formatted as ext2 (apparently better than ext3 or ext4 for flash drives since no jornalling means fewer writes).

Is there some reason why the same method with the same group of files will not work as a dual boot now? (extlinux.conf instead of the syslinux.cfg file but with the same content).

Interestingly, PUI made the SD card bootable (installed extlinux.sys) after I formatted it as ext2 but PUI did not make it bootable when I had previously formatted it as ext4 but I am not sure if this happened because I had installed mbr.bin to the boot sector (using the "cat mbr.bin >/dev/sdb" command) after the ext4 attempt.

EDIT:- Just testing PUI with a USB flash drive and it works OK with ext2 and ext3 (installs extlinux.sys and extlinux.conf) but ext4 does not work - it says it can't find the device for /mnt/data and extlinux.sys does not get installed.

If I download and unpack the syslinux tarball, running (with the partition mounted):-

Code: Select all

./extlinux --install /mnt/sdb1

from the extlinux subdirectory installs the file ldlinux.sys rather than extlinux.sys but it still boots with that file too so it is possible to make ext4 work that way. I have done this on a desktop computer booting from a USB hard drive formatted ext4.

I downloaded syslinux version 4.06 so perhaps I should go back and use 4.04 instead?

To be honest, BIOS "dual booting" is OK for me on this little netbook since I hardly ever boot into Win XP, but it would be nice to know if the method will work in this scenario. I would rather have Puppy Linux running in a linux file system on the SD card. It does not bother me that Win XP will not have access to the files on the SD card. I can always have Puppy "push" files across onto the HDD partition if need be.
Last edited by OscarTalks on Fri 02 Nov 2012, 23:40, edited 1 time in total.
Oscar in England
Image

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#14 Post by greengeek »

OscarTalks wrote:Were you using the command?:-

Code: Select all

cat mbr.bin >/dev/sdc1
If so, should that not be without the number on the end (boot sector, not partition)? eg:-

Code: Select all

cat mbr.bin >/dev/sdc
Ahhhhh, yes. You are quite right of course. Thank you for filling in that missing part of my understanding. I've just compared your syntax with mine and it seems that my incorrect syntax was the whole reason why I needed to re-run Gparted. My apologies to all for the bad info. (Well - my method does work, but now that I understand the finer points of mbr writing I shall test and post the necessary corrections to my method).EDIT:corrections to first 2 posts now complete.

Also, my next trials will be using an 8GB stick with a small FAT32 boot partition, an EXT2 partition to contain the frugal Puppy files, and a small Linux swap partition. (I think that is similar to what you have been aiming at??)

Post Reply