how to expand dosubcd.img and make it still bootable?

Try looking for help here if you are having problems with the Ultimate Boot CD.

Moderators: Icecube, StopSpazzing

Message
Author
hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

how to expand dosubcd.img and make it still bootable?

#1 Post by hoohooslax » Tue Jun 24, 2008 8:21 am

I was trying to expand dosubcd.img to ~10Mb so that I can put more files in. I tried to "Change format...->select custom image format" in WinImage and expended dosubcd.img to ~10Mb. I re-zipped dosubcd.img to dosubcd.igz in /images. But now FreeDos is no longer bootable. Any help would be greatly appreciated!!!

Icecube
Posts: 1278
Joined: Fri Jan 11, 2008 2:52 pm
Contact:

#2 Post by Icecube » Tue Jun 24, 2008 8:53 am

See http://syslinux.zytor.com/wiki/index.ph ... ppy_images.
If you find that a 1.44MB or 2.88MB disk image is not enough you can grow the image and still be able to boot off this image. Images as large as 10MB have been successfully deployed. The procedure to grow you image is as follows:

* Start with a working bootable 1.44MB or 2.88MB image
* Use the mkfloppyimg.sh or newmkfloppyimg.sh script from http://people.cs.uchicago.edu/~gmurali/ ... loads.html to grow the image size.
* When booting it with MEMDISK or mounting it using mtools, dont forget to specify the non-standard geometry (which is given my the scripts).
* Now that you have more space you are free to add more stuff to the image.
You need linux to make the image.

hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

#3 Post by hoohooslax » Tue Jun 24, 2008 9:48 am

Thanks again for your reply.

i ran the script but it complains about finding mkdosfs. I use SLAX. If you have an idea where mkdosfs is in SLAX, it will be super super helpful for me. Thank you!

hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

#4 Post by hoohooslax » Tue Jun 24, 2008 10:44 am

Now i got it run without error. But the expended dosubcd.img is still not bootable....it's really fustrating....>_<

Icecube
Posts: 1278
Joined: Fri Jan 11, 2008 2:52 pm
Contact:

#5 Post by Icecube » Tue Jun 24, 2008 4:37 pm

I have made an hard disk image from the freedos image.

To add files to the hard disk image, boot into linux.

- Make a directory dosubcdhd in your home directory (~/dosubcdhd):

Code: Select all

mkdir ~/dosubcdhd
- cd to the dosubcdhd folder:

Code: Select all

cd ~/dosubcdhd/
- Download the hard disk image:

Code: Select all

wget http://ubcd.110mb.com/download/dosubcdhd/dosubcdhd.txt
wget http://ubcd.110mb.com/download/dosubcdhd/dosubcdhd.md5.txt
wget --base=http://ubcd.110mb.com/download/dosubcdhd/ -i dosubcdhd.txt --output-document=dosubcdhd.img.tar.bz2
- Check if the file is downloaded correctly:

Code: Select all

md5sum -c dosubcdhd.md5.txt
- The output should be: dosubcdhd.img.tar.bz2: OK.
- Extract dosubcdhd.img out of dosubcdhd.img.tar.bz2. It is a hard disk image of 25MiB.

Code: Select all

bzip2 -dc dosubcdhd.img.tar.bz2 | tar xvf -
- Make a directory inside ~/dosubcdhd, also called dosubcdhd (~/dosubcdhd/dosubcdhd/):

Code: Select all

mkdir dosubcdhd
- Make you root (on ubuntu sudo su, on slax maybe su only (I never used slax so see for yourself how to gain temporary root acces)
- Mount the hard disk image into your filesytem with the following commands

Code: Select all

losetup -o 32256 /dev/loop0 dosubcdhd.img
mount -t vfat /dev/loop0 ./dosubcdhd
- Now you can copy files to the image file by copying files into ~/dosubcdhd/dosubcdhd/.
- If you have copied all the files that you want to copy to the image, write zeros to the empty space of the hard disk image, so you can compress the image better.

Code: Select all

dd if=/dev/zero of=~/dosubcdhd/dosubcdhd/zerodisk.txt
rm ~/dosubcdhd/dosubcdhd/zerodisk.txt
Unmount the image and remove the loop device

Code: Select all

umount dosubcdhd
losetup -d /dev/loop0
- Type "exit" to loose root rights.

Compress dosubcdhd.img with gzip and rename the gzipped image to dosubcd.igz and place it in "/images/" of your ubcd folder.
Last edited by Icecube on Wed Jun 25, 2008 11:25 am, edited 3 times in total.

hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

#6 Post by hoohooslax » Wed Jun 25, 2008 9:06 am

Icecube, thank you so much for spending this significant amount of time to solve my headache. And you are a real good doctor^_^

I have downloaded dosubcdhd.bz2. After I run bunzip2 dosubcdhd.bz2, what I got is a file called "dosubcdhd" instead of "dosubcdhd.img". I tried to rename it to .img file, but Slax doesn't allow me to mount this .img to a folder. So I got stuck here, not knowing how to "Extract dosubcdhd.img out of dosubcdhd.bz2. It is a hard disk image of 25MiB."

The "dosubcdhd" file I got is 25MiB, so i think i got the right file, but just don't know how to deal with it.

Icecube
Posts: 1278
Joined: Fri Jan 11, 2008 2:52 pm
Contact:

#7 Post by Icecube » Wed Jun 25, 2008 9:58 am

I bzipped the dosubcdhd.img with file-roller.
Aparently you have to unbzip the file and afterwards, you have to untar it. I didn't know it myself :o . I do this always graphically.

The command that you must use:

Code: Select all

bzip2 -dc dosubcdhd.bz2 | tar xvf -
I edited my previous post.
I renamed dosubcdhd.bz2 to dosubcdhd.img.tar.bz2 to make it clear that the file is also tarred.
I added the unachiving command:

Code: Select all

bzip2 -dc dosubcdhd.img.tar.bz2 | tar xvf -

hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

#8 Post by hoohooslax » Wed Jun 25, 2008 10:57 am

Thank you so much ~

I added the files, rezip it as dosubcdhd.img.gz, copy it to /images/dosubcd.igz, but freedos still doesn't start up in UBCD. Is my way wrong?

Without any additional files added in dosubcdhd.img, I zipped it and send it to /images/dosubcdhd.igz, freedos is still not bootable. Have you tried it out?

Icecube
Posts: 1278
Joined: Fri Jan 11, 2008 2:52 pm
Contact:

#9 Post by Icecube » Wed Jun 25, 2008 11:35 am

Download it again and follow every instruction.
If you have done the bzip2 -dc dosubcdhd.img.tar.bz2 | tar xvf - step, you should get an image file dosubcdhd.img.

Code: Select all

md5sum dosubcdhd.img
The output of the previous command should be: a37b854149b4649e763661419c647abf dosubcdhd.img
If not, there is something wrong with the download.

Use this file as a hard disk image for booting in a virtual machine (e.g. in qemu, virtualbox, vmware). It should boot (It worked for me). If this works, stop the virtual machine and go further with the instructions.

Test the file again in a virtual machine when you have added your files and you have unmounted the image.

If you gzip the image file, rename the gzipped file to dosubcd.igz when you copy it to /images of the ubcd folder.

I don't know if it matters, but I have updated all the isolinux files (isolinux.bin, memdisk, menu.c32, chain.c32). For you, memdisk maybe have to be updated.
See for the relevant part at viewtopic.php?t=1350.

There is also a free tool called ImDisk Virtual Disk Driver which is able to mount hard disk images under windows.
See: http://www.ltr-data.se/opencode.html#ImDisk

hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

#10 Post by hoohooslax » Fri Jun 27, 2008 4:09 pm

I tried Imdisk in Windows XP, but when I mounted dosubcdhd.img, its file system could not be recognized.

I tried WinImage and added files to dosubcdhd.img, its not bootable from UBCD.

I tried to mount the image in SLAX following your instruction, SLAX said ./dosubcdhd is busy. When I opened the ./dosubcdhd, nothing was there.
Neither was 'mount -o loop' working, too.

I am not familiar with the DOS emulator too>_< If there's any chance, could you please tell me what emulator you are using and how do you emulate your image file and see if it's bootable? Thank you very very much for your time~~~~

as702
Posts: 276
Joined: Tue Jun 17, 2008 3:14 am

#11 Post by as702 » Sat Jun 28, 2008 5:48 am

here's how to (and no, you don't need linux):

download a bootable disk image of your desired size from here

extract image using either unrar/7zip (or similar). can't remember which (might require both).

use winimage to inject the files you wish to use (in this instance those from dosubcd) into the downloaded bootdisk from above.

save it.

place back in ISO (/images or /custom)

edit the appropriate *.cfg file in /menus from where you'll be launching the boot disk from.

example:

Code: Select all

LABEL fd
        MENU LABEL FreeDOS BootDisk
        KERNEL memdisk
        APPEND initrd=/images/fd011520.img c=240 h=8 s=36 floppy
where "fd011520.img" is the name of your image

c(cylinders),h(heads),s(sectors). the above is for an 11520KB image. you can change these values to suit your boot image (use winimage to view the setting you require -> menu ->image -> change format... -> select custom image format -> ok)

you don't need to apply any changes to the image itself.

that's it.

Icecube
Posts: 1278
Joined: Fri Jan 11, 2008 2:52 pm
Contact:

#12 Post by Icecube » Sat Jun 28, 2008 1:22 pm

hoohooslax wrote:I tried Imdisk in Windows XP, but when I mounted dosubcdhd.img, its file system could not be recognized.
Go to the ImDisk Virtual Disk Driver in the control panel and start it.
Click on "mount new..."

Mount new virtual disk:
  • Image file: dosubcdhd.img
    Drive Letter: Choose one
    Size of virtual disk: (current image file size)

    Image file offset (for non-raw disk image file formats):
    32256 (in bytes)
    (this offset is needed to tell Imdisk to skip the mbr and the first sector of the harddrive image, after this 32256 bytes the partition with freedos "begins. In linux the "losetup -o 32256 /dev/loop0 dosubcdhd.img" command skips this bytes also.
    In this case (and in general also), the first partition starts at sector 63. Knowing the sector size (standard is 512 bytes), we can easily calculate the offset in bytes to the first partition: 512 * 63 = 32256.
    )

    Device type: Harddisk volume
I added two files (12 MiB total size) and tested the image. It worked for me.
hoohooslax wrote:I tried WinImage and added files to dosubcdhd.img, its not bootable from UBCD.
I have never used it, but normally it should work with this program also. It is able to modify harddisk images. I haven't test it, it is shareware so you can use it only 30 days for free which sucks. Use Imdisk instead. I have tested it and it works definitely.
* Supports the creation of large images of removable and hard disks under Windows NT and Windows 95. Large images (> 2.88 MB) are not loaded into memory, read and write operations are done directly on image files.
hoohooslax wrote:I tried to mount the image in SLAX following your instruction, SLAX said ./dosubcdhd is busy. When I opened the ./dosubcdhd, nothing was there.
Neither was 'mount -o loop' working, too.
Try it again. I have just copied al the instructions, that I have written down in the first post, to the terminal on a different PC. And everything worked. Are you sure that you didn't cd to ./dosubcdhd two times before mounting the image? It can be, however that slax doesn't support every command.
Try the next:

Code: Select all

ls /dev/loop*
The output should be something like this (the number of /dev/loop[number] can differ). If you don't get any output, slax doesn't have a loop device and my tutorial is useless for you. :(
/dev/loop0 /dev/loop2 /dev/loop4 /dev/loop6
/dev/loop1 /dev/loop3 /dev/loop5 /dev/loop7

hoohooslax wrote:I am not familiar with the DOS emulator too>_< If there's any chance, could you please tell me what emulator you are using and how do you emulate your image file and see if it's bootable? Thank you very very much for your time~~~~
I don't use a DOS emulator. I use QEMU, which is virtual machine (available for linux, windows, Mac OS X, OpenSolaris). Normally it is only a command line tool ,but for linux at least in ubuntu you can use "Qemu Launcher" or "Qemulator" as GUI for QEMU. "Qemu Manager" is a GUI for QEMU if you use windows.
Download QEMU:
See: http://bellard.org/qemu/download.html
Qemu Manager (GUI for Qemu for windows):
See: http://www.davereyn.co.uk/download.htm
Add the harddrive image as hard disk to QEMU.

I hope that this explanation helps and that you can get the image working. I checked the whole tutorial and it worked perfect for me. After adding files to the image, the image is still bootable in my case so normally it should work. I added 2 files to it thought Imdisk and 1 via linux and it was always bootable. I tested the tutorial on 2 different pc's. If you have problems, don't hesitate to ask.

as702
Posts: 276
Joined: Tue Jun 17, 2008 3:14 am

#13 Post by as702 » Sat Jun 28, 2008 4:31 pm

my method's simpler by far. :wink:

btw, i've never heard of QEMU. how does it compare to VMware and VPC2007 for windows?

Icecube
Posts: 1278
Joined: Fri Jan 11, 2008 2:52 pm
Contact:

#14 Post by Icecube » Sun Jun 29, 2008 6:22 am

@as702
Hoohooslax tried to do it with winimage and didn't succeed.
hoohooslax wrote:I tried WinImage and added files to dosubcdhd.img, its not bootable from UBCD.
So probably winimage isn't that simple at first glance. :)

"ImDisk Virtual Disk Driver" is probably the easiest way to add files to an existing image in windows because the image just appears in explorer as extra drive letter.

QEMU can be run without admin privileges (useful for on an usb stick), but it is slow. If you have admin privileges you can install KQEMU (linux) or QEMU Accelerator (windows), which makes it possible to run user mode code directly on the host computer's CPU, and using processor and peripheral emulation only for kernel mode and real mode code, which speed up the the process significantly..
KQEMU

Fabrice BelQEMU Acceleratorlard also wrote a Linux kernel module (with preliminary ports to FreeBSD and MS Windows) named KQEMU or QEMU Accelerator, which notably speeds up x86 emulation on x86 platforms. This is accomplished by running user mode code directly on the host computer's CPU, and using processor and peripheral emulation only for kernel mode and real mode code. KQEMU also supports a kernel emulation mode in which portions of kernel mode code run on the host's CPU.

Unlike KVM, KQEMU can execute code from many guest OSes even if the host CPU does not support hardware virtualization. KQEMU supports both x86 and x86_64 CPUs. As a future development[3] for KQEMU there are plans to support the hardware(CPU) based virtualization extensions introduced by Intel VT and AMD-V families of processors. The increased speed is not expected to be significant so perhaps more important is the plan to include support of SMP for "guest" OS.
For more information: http://en.wikipedia.org/wiki/QEMU

as702
Posts: 276
Joined: Tue Jun 17, 2008 3:14 am

#15 Post by as702 » Sun Jun 29, 2008 12:50 pm

@cube

yes, but he hadn't tried my explicit method (i had a similar problem).

;)

whatever works, best of luck to him(?).

Qemu sounds interesting. i'll admit, i did try it out shortly after the post (thanks for the link btw). i agree, it is rather slow and a bit more cumbersome to get up and running than the aforementioned alternatives (at least on windows platform).

vmware is probably the fastest i've come across thus far (albeit it's a bit of a mess). for bog standard unix/linux/dos/winpe bootdiscs, i tend find vpc2007 is quite robust.

Icecube
Posts: 1278
Joined: Fri Jan 11, 2008 2:52 pm
Contact:

#16 Post by Icecube » Sun Jun 29, 2008 1:19 pm

@as702
VirtualBox is also a very good emulator. It runs on Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD. It is comparable in speed with VMware and you don't have to register to get a key. I use VirtualBox to run Windows on Ubuntu and it is fast enough for me.
http://www.virtualbox.org/

I use qemu-launcher most of the time to test a simple iso like ubcd or a small live linux distro because it is very easy to select the amount of ram to use and the iso you want to boot without to edit a complete virtual machine like you have to do with vmware, virtualbox and Qemu (Qemu Manager).

hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

#17 Post by hoohooslax » Mon Jun 30, 2008 9:23 am

as702 wrote:

Code: Select all

LABEL fd
        MENU LABEL FreeDOS BootDisk
        KERNEL memdisk
        APPEND initrd=/images/fd011520.img c=240 h=8 s=36 floppy
where "fd011520.img" is the name of your image

c(cylinders),h(heads),s(sectors). the above is for an 11520KB image. you can change these values to suit your boot image (use winimage to view the setting you require -> menu ->image -> change format... -> select custom image format -> ok)
Thanks a lot as702! Your method works! But when I tried to expand the 11M image, it didn't boot again! Do I need to change the c, h, s value accordingly? If you have a clue, please let me know.

Also, I tried to download the 50MB image from the link you provided. I use WINRAR to unzip it to fd500000.ima. However, I couldn't make change to this file in WinImage Unregistered version. Could you please tell me how do you make it editable? Many Thanks!!!

as702
Posts: 276
Joined: Tue Jun 17, 2008 3:14 am

#18 Post by as702 » Mon Jun 30, 2008 11:00 am

Thanks a lot as702! Your method works! But when I tried to expand the 11M image, it didn't boot again! Do I need to change the c, h, s value accordingly? If you have a clue, please let me know.
no worries, pal. when you say "expand" do you mean you're trying to change the image size in winimage? if so, then i'm not sure since whenever i've tried this method the image always fails to boot (winimage can prove buggy). what i usually do is resort to downloading the image size i need from the link i provided.

c,h and s values typically go as follows:

for 005760
c=240 h=4 s=36
for 115200
c=240 h=8 s=36
for 050000 it would be:
c=2 h=255 s=63
i've tested the 50mb image with these settings and can confirm it DOES work. :) give it a shot.
Also, I tried to download the 50MB image from the link you provided. I use WINRAR to unzip it to fd500000.ima. However, I couldn't make change to this file in WinImage Unregistered version. Could you please tell me how do you make it editable? Many Thanks!!!
hmmm...you could try registering your version of winimage. other than that i'm not too familiar with what else is out there.

hoohooslax
Posts: 19
Joined: Fri Jun 13, 2008 11:06 am

#19 Post by hoohooslax » Mon Jun 30, 2008 12:18 pm

as702:

Thanks man! You nailed it! I wonder where do you get the number of the cylinders? I tried to go to Change Format->select custom image format, but it only shows heads and sectors, no info about cylinders?

Icecube:

Thanks for all the tips and tools you provided. They all help me a lot. I enjoy using imgdisk a lot! Many thanks!

as702
Posts: 276
Joined: Tue Jun 17, 2008 3:14 am

#20 Post by as702 » Mon Jun 30, 2008 12:42 pm

hoohooslax wrote:as702:
Thanks man! You nailed it! I wonder where do you get the number of the cylinders? I tried to go to Change Format->select custom image format, but it only shows heads and sectors, no info about cylinders?

Code: Select all

capacity = cylinders * number of heads per cylinder * number of sectors per head * 512
winimage should tell you (that's how i got the values).

if i remember correctly, "sectors per cluster" = cylinder(s)

Locked