Page 1 of 7

UBCD on a USB Flash Disk (USB Key)

Posted: Sun Jun 12, 2005 1:02 pm
by Limerick
Hello All,

I know that my request is in "You can help" page, but maybe someone managed to do so and forgot to mention it... :wink:

So, is there a mean to put UBCD on a USB Flash Disk ? Did someone succeeded ?

I use windows xp.

Thanks for your help... if possible.


Posted: Wed Jun 15, 2005 6:18 am
by dhscholtus
i am sure this is a possibility.
The important thing about making a usb drive bootable is you need a bootsector in binary format, so i mean a kind of bootsector.bin wich contains the bootsector.

if you have this bootsector you can write it to the usb drive and the only thing to do is simply copy data files to the drive.

Ultimateboot cd is using such kind of bootsector binary file i think,we can find it somewhere in the /boot directory i quess.
in that dirrectory are a few .bin files which are probably floppydisk bootsector files.

Posted: Thu Jun 16, 2005 5:44 am
by Limerick
Yes you're certainly right dhscholtus, but I don't know how to proceed... :oops:

Victor, do you think it's possible ?
Would it be difficult to give some explanation of how to do it ?

Posted: Thu Jun 16, 2005 7:30 pm
by Victor Chew
This stuff is currently out of my league. :shock:

If I had a clue on how to proceed, I would have posted some leads long ago.

Posted: Fri Jun 17, 2005 6:36 am
by Limerick
Victor Chew wrote:This stuff is currently out of my league. :shock:

If I had a clue on how to proceed, I would have posted some leads long ago.
Sorry for my question Victor :?
I asked it because things seem to be quite easy to dhscholtus, and I thought you could understand what he said and gives you an idea of how to proceed :oops: :wink:

Posted: Sun Jun 26, 2005 3:40 pm
by reblu
I am also playing with this idea and I have managed to get close to it. The main problem is that UBCD uses cdshell as the boot manager, which only supports ISO 9660 filesystems. But you cannot put such filesystem on a usb drive.

So, as an alternative I am using SYSLINUX, MEMDISK and the advanced menu system of Murali Krishnan Ganapathy.

This is how it looks like for now:

The main problems that I am currently facing are:
- The menus have to be compiled. I have only managed to do this on Linux, not on Cygwin.
- The images seem to have to be placed in the root folder, so I'll end up with a root folder completely messed up...

Here is a summary of the steps to build the UBUSB (instead of UBCD)
1.- Download Syslinux from the link above and load Syslinux on the USB Drive. On Windows, just run (replacing i: with the actual letter of the usb drive)

Code: Select all

syslinux i:
2.- Copy memdisk to the root of the drive as well
3.- Create a syslinux.cfg file in the drive with the following content:

Code: Select all

DEFAULT ubusb.c32
4.- Create the menu and compile it. This can be done by modifying simple.c in the menu subfolder of the sysconfig package, then renaming it to ubusb.c and typing "make".
5.- Put the appropriate images in the root of the usb drive as per the modified menu.

Step 4 is easier said than done, and it is where all the complexity is. As I said, I was not able to build it with cygwin and I had to use a Linux box...

Note that Syslinux provides two much simpler menu systems that can be used when there are not many images to load. The advantage is that they do not need to be compiled. The problem with those is that they do not allow submenus...

The first of the simpler menus is based on just using the syslinux.cfg
You just put something like

Code: Select all

DISPLAY Menu.txt
KERNEL memdisk
APPEND initrd=freedos.img 

KERNEL memdisk
APPEND initrd=cpuburn.igz

KERNEL memdisk
APPEND initrd=discwiz.igz
and Menu.txt can contain something like:

Code: Select all

1.- Freedos
2.- CPU Burn-in
3.- Disc Wizard
Since it will be the menu that will be shown.

The second of the simple options is based on using the modules of the com32\modules subfolder. It provides a nicer menu, but it still lacks the possibility to have submenus...

Posted: Sun Jun 26, 2005 5:49 pm
by Victor Chew
I was wondering if it was possible to reuse the menuing logic from the CDShell project. I think that is done in "cdsh.bin"?

Hmmm... gotta grab me a USB memory stick and try it out!

Posted: Sun Jun 26, 2005 10:54 pm
by NwDsk
Thanks Reblu.

This indeed looked like the best approach to me also. I have been experimenting a bit with it along exact same lines as you did.

I consider the syslinux way with the advanced menu-system as the way to go but I got intimidated by the idea that this would need some automated script that would recreate the menu32.c-formatted UBCD menu from the CD-Shell menus.

The simple menu would not be an option indeed because of the lack of submenus. And yes the root becomes a mess...

But great to see someone exploring this successfully, even with the advanced-menu system. I only tested conceptual working of it by using the simple menu-system, and dropped it there due to lack of time.

To get USB booting working for UBCD would be great!


Posted: Mon Jun 27, 2005 4:50 pm
by reblu
The process seems to be working quite well, despite the crammed root folder.
I am actually running into another problem, though: when I select a freedos tool it does not automatically start it... Researching the problem I have found that the UBCD.bat file actually assumes it is being booted from a CD and looks for the tool using the CD letter and it fails...

My USB drive gets assigned the B: letter, while the CD gets the T:, I believe.

I am not sure all the USB drives will get assigned the B:... Any thoughts on how the USB drive letter should be guessed from the command line? Once found the way to identify the letter, maybe the FreeDos image can be modified to support this...

Posted: Mon Jun 27, 2005 10:32 pm
by NwDsk
I don't know either if we can rely on B:. I doubt it. However what I could do is add an enumeration of all accessible drives and test for existance of some tag-file (or some images in the root) and set the default drive accordingly. This can be done with just some added batch-lines (using the wrapper drd.bat).

But could you tell me if the parameter that identifies the calling app is processed correctly? It is put in ENV-var UBCDCMD.
What does UBCDCMD read when you run SET (and CD1) ?


Posted: Mon Jun 27, 2005 11:15 pm
by reblu
I was thinking on a solution based on enumeration as well, but I am not sure how to implement it. By the way, the parameter is processed correctly: UBCDCMD has the parameter that I passed through memdisk, but CD1 actually has T: (while the USB drive is B:)

Posted: Mon Jun 27, 2005 11:53 pm
by NwDsk
Good! I just made the ubcd-bootdrive detection more generic. It will enumerate all accessible drives starting with the drive suggested by bcdw (which is the booted CDROM drive). Then it will check for \ubcd\ubcd.css (so make sure that file is also on your USB).
This way it should handle the ISOs as usual (and fast since that is the first tested drive) and if it was not booted from a CDROM it hooks on to the first UBCD it finds on the available drives. Maybe we should check some more tag-files to prevent mismatches. BTW, this way the freeDOS apps on UBCD would also work pseudo-booted from a simple bootflop and just looking for a UBCD somewhere on the attached drives ...
[*editted*]Not autostarting any app because there is no app choosen yet ...[*/editted*]

A beta of FDUBCD.IMG is available at:
Please rename it to FREEDOS.IMG and replace the one you are currently using with this one. When booted it should identify itself as version 3.26.

Let me know if this works.


Posted: Tue Jun 28, 2005 1:11 am
by reblu
Thanks! I'll check it this evening (I'm in Europe and currently at work) and I'll let you know.

Posted: Tue Jun 28, 2005 12:52 pm
by reblu
Seems to be working beautifully. It shows some errors when cycling through the different drives, but it properly identifies B: as the UBCD drive.
Thank you!

Posted: Tue Jun 28, 2005 1:18 pm
by NwDsk
What errors exactly do you see? We might be able to iron these out.
And do the dos-apps launch automatically now?

Maybe you could email me off-list for this (see for my email address).



P.S. How is the menu32-source looking? Maybe we could get some sort of SED-script working to automatically recreate the menu32 from Victor's original CD-shell menus. I once made a parametrized version of his menus that might be usable as starting point for this ...

Great to see finally some progress on the USB front with UBCD!

Posted: Tue Jun 28, 2005 10:51 pm
by reblu
I sent you an email directly. Anyway, another problem I am facing is that some images cannot be used with memdisk (e.g. windiag)... Is there a way of using "diskemu" and "boot" with syslinux? Any tips anybody?

Posted: Fri Jul 01, 2005 4:14 pm
by reblu
The menu is taking shape nicely. I am still having problems with Windiag and with booting from the primary and secondary harddisk, since syslinux does not actually allow the localboot command. I was thinking on calling another module that allows it, like diskemu, but diskemu does not seem to accept the boot command in the append parameters... Another option is to code it directly in C inside the menu system, but I do not know the instructions to perform such actions... Any ideas anyone?

Posted: Sat Jul 02, 2005 9:04 am
by NwDsk

That can be done by adding chain.c32 from the syslinux package. Here is an example form a syslinux.cfg I use on some bootflops. You can even boot from each partition on each HD if you like to do so (see chain.c).

Code: Select all

say 1) Boot HD (first)
say 2) Boot HD (second)
say 3) Boot floppy
say 4) Boot CDROM
label 1
    kernel chain
    append hd0
label 2
    kernel chain
    append hd1
label 3
    kernel chain
    append fd0
label 4
    kernel memdisk
    append initrd=BCDL.IMZ
Adding BCDL.IMZ from (BCDW 2.01a) adds booting from CDROM which may not be a usefull addition for the original UBCD but might be for the USB-UBCD.


Posted: Sat Jul 02, 2005 2:59 pm
by reblu
Thanks! It works perfectly.

By the way, I am testing the menu with bochs and the combination memdisk and windiag.img actually works in the virtual machine! So it seems to be BIOS dependent.

Posted: Mon Jul 04, 2005 3:00 pm
by reblu
Ok I think I am ready to explain how to create the Ultimate UBCD on a USB drive, despite the lack of interest in the poll (there are only 5 votes). Still, this thread seems to have quite a few views...

I hope this is not a long post. I’ll call the package the UBUSB. The instructions are basically for Windows users, but should not be much different for Linux users.

You will need:
My UBUSB menu package
The modified version of the freedos image (FDUBCD.IMG)

For offline pwd recovery and grub, you will need the igz equivalents of the iso and to allow booting from the CD ROM you will need the the bootable CD Wizard image

Finally, obviously the UBCD iso

If you do not want to burn the ISO to access the contents to copy them to the USB, you can use a tool like virtualCDcontrolpanel

Note that I have not managed to be able to run INSERT, windiag, g4u or rip.

1.- In order to improve the compatibility of the drive with the most number of BIOS, we will format the drive in USB-ZIP compatibility mode, we will make it bootable and we will load syslinux in it (WARNING: THIS WILL REMOVE ALL THE CONTENTS OF THE USB DRIVE)
1.1 Unzip the Makebootfat package to a folder. Unzip Syslinux to another folder and Copy ldlinux.sys, mbr.bin and ldlinux.bss from the Syslinux folder into the makebootfat folder
1.2 Open a DOS window, go to that folder and type
makebootfat -o usb -Z -Y -b ldlinux.bss -m mbr.bin -c ldlinux.sys

2.- Copy all the contents of the \images subfolder of the UBCD into the root of the USB drive

3.- Copy the rest of folders to the USB drive directly, except the boot folder. So your USB drive will have all the subfolders of the UBCD, except for the folders "boot" and "images". Your USB drive root folder will contain all the images.

4.- Remove grub.iso and offline.iso from the root of the USB drive.

5.- Copy the contents of my menu package in the root folder of the USB drive

6.- copy the new images of bcdl, grub and offline to the root of the USB drive.

7.- Rename the freedos image from FDUBCD.IMG to freedos.img and copy it as well to the root of the USB drive.

8.- Copy chain.c32 to the root of the USB drive from the com32/modules subfolder of the syslinux package

I hope somebody finds this useful.
[Edit: Link to Syslinux updated to 3.09]