VOGONS


Reply 20 of 24, by mike_canada

User metadata
Rank Member
Rank
Member

Ok, now something is weird with the image file itself. This is what I done from start to finish:

In unix terminal....

cd myimagefolder
mkfatimage16 -p -k 32768 -f image
dosemu

Then in dosemu window (since I already connected the floppy drive to a boot disk image I downloaded off the net....

fdisk
sys a: c:

(I checked fdisk in the window and it reported the virtual c drive as being a valid DOS partition and I could do dir c: to get contents)

I force-close the dosemu window, then in the same unix terminal, I then enter...

dd if=image of=image2 iflag=skip_bytes skip=128
mkdir outiso
mkisofs -b image2 -hard-disk-boot -o new.iso ./outiso

It seems promising since the output is:

Setting input-charset to 'UTF-8' from locale. Size of boot image is 65552 sectors -> Emulating a hard disk 30.20% done, estimat […]
Show full quote

Setting input-charset to 'UTF-8' from locale.
Size of boot image is 65552 sectors -> Emulating a hard disk
30.20% done, estimate finish Sat Jul 24 15:13:50 2021
60.43% done, estimate finish Sat Jul 24 15:13:50 2021
90.57% done, estimate finish Sat Jul 24 15:13:50 2021
Total translation table size: 2048
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 22000
16564 extents written (32 MB)

and the iso file is roughly the correct size.

So k3b cd burner software happily burns the CD.

I put the CD in the target machine, try to boot it up, and instead of being told to insert a system disk, it recognizes it as a hard drive then the system stalls and my only option then is to turn off the computer.

The exact message on the screen since the target machine is a Dell Wyse thin client is:

Boot from CD :
1. HD System Type-(04)

After it prints that, it stalls.

I'm guessing I need to somehow redo the MBR

Reply 21 of 24, by mike_canada

User metadata
Rank Member
Rank
Member

Ok, I think I figured it out.
Well, at least I got it where the CD boots, the command prompt loads and the disk free space is accurate.

So here's how to do it if you want a 32MB bootable hard drive from CD:

1. Get dosemu installed,
2. create the folder named disk in your root drive,
3. change to "/disk" folder
4. create the file /disk/emu.conf and put these contents in it:

$_vbootfloppy="/disk/dos6.22.img +hd"
$_hdimage = "/disk/myimage"

5. Get a valid dos boot floppy image and put it in the "/disk" folder. Mine is called dos6.22.img. That image must be able to boot dos 6.0 or later. Windows 9x/me boot disks would work too.

6. create a script that contains the following contents. Save it as something and put the file in the "/disk" folder.

#!/bin/bash
cd /disk
mkfatimage16 -p -f myimage -k 32767
dosemu -f emu.conf
dd if=myimage iflag=skip_bytes skip=128 of=myimage2
mkdir outiso
cp myimage2 -t outiso
mkisofs -b myimage2 -hard-disk-boot -o new.iso ./outiso

7. execute the script. Dosemu box should appear and you should see its own bios screen with a "Starting (insert os)....". If you get a menu of options, you don't need to load any additional drivers.

Once you see the familiar command prompt, you'll need to execute the following 2 statements.
I discovered that failing to execute the last statement was what caused the DOS boot sequence to freeze before anything appeared on screen.

SYS A: C:
FDISK /MBR

8. copy whatever necessary over to the C: drive and that will be on the bootable CD later.

9. force-close dosemu

The rest of the script will create another image file then an iso file ready to be burned onto the CD
Then in your favorite burning software, when you make the CD, you need to choose the image file (/disk/new.iso) as the thing to burn.

Reply 22 of 24, by darry

User metadata
Rank l33t++
Rank
l33t++

Glad you got it to work and thanks for sharing the steps.

Just a question as to what distro/release you are using as compiling the latest release of the original DOSEMU on current Debian is, to put it mildly, less than fun .

Reply 23 of 24, by darry

User metadata
Rank l33t++
Rank
l33t++

I also managed to create a successfully bootable ISO, but did not use DOSEMU and did so on a current Linux distro with a 5.10 kernel . I used a Windows 98 SE bootable rescue floppy (as created in Windows 98 SE) as a starting point, but this should be adaptable to practically any DOS version (ok, maybe not if your preferred version does not have fixed disk support 😉 )

If using a version of DOS below 5.00 , DOS fdisk will not have an /mbr option . This means that the partitioning and formating will need to be done manually on the mounted disk image from within DOSBox (I have tested this once : instead of creating the partition with Linux fdisk, I did it from within DOSBOX and then DOS 7.1's format /s was enough the make the partition successfully bootable without running fdisk /mbr )

a) use bximage to create a 504MB image file ( could have used dd, but bximage calculates cylinder count for me) :
bximage -mode=create -hd=504 -imgmode=flat -q /disk/newc.img

root@openmediavault:/disk# bximage -mode=create -hd=504 -imgmode=flat -q /disk/newc.img
========================================================================
bximage
Disk Image Creation / Conversion / Resize and Commit Tool for Bochs
$Id: bximage.cc 13069 2017-02-12 16:51:52Z vruppert $
========================================================================

Creating hard disk image '/disk/newc.img' with CHS=1024/16/63

The following line should appear in your bochsrc:
ata0-master: type=disk, path="/disk/newc.img", mode=flat

Spoiler

b) use Linux fdisk to create a DOS partition table with a single FAT16 NON-LBA partition (type 6) I also set partition active/bootable :
printf "o\n n\n p\n 1\n \n \n t\n 6\n a\n w\n" | fdisk -c=dos /disk/newc.img

root@openmediavault:/disk# printf "o\n n\n p\n 1\n \n \n t\n 6\n a\n w\n" | fdisk -c=dos /disk/newc.img[/b]

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
DOS-compatible mode is deprecated.

Created a new DOS disklabel with disk identifier 0x5e45079f.

Command (m for help): DOS-compatible mode is deprecated.

Created a new DOS disklabel with disk identifier 0xedc7fe70.

Command (m for help): Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): Partition number (1-4, default 1): First sector (63-1032191, default 63): Last sector, +/-sectors or +/-size{K,M,G,T,P} (63-1032191, default 1032191):
Created a new partition 1 of type 'Linux' and of size 504 MiB.

Command (m for help): Selected partition 1
Hex code (type L to list all codes): Changed type of partition 'Linux' to 'FAT16'.

Command (m for help): Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): The partition table has been altered.
Syncing disks.

root@openmediavault:/disk# fdisk -l /disk/newc.img
Disk /disk/newc.img: 504 MiB, 528482304 bytes, 1032192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xedc7fe70

Device Boot Start End Sectors Size Id Type
/disk/newc.img1 * 63 1032191 1032129 504M 6 FAT16

Spoiler

c) Tweak the Windows 98 SE boot floppy image # warning do not boot from that floppy image unless you intend it to automatically format the c: drive without prompting:
mount /disk/win98floppy.img /mnt
sed -i 's/menudefault=CD,30/menudefault=NOCD,1/g' /mnt/CONFIG.SYS
dos2unix /mnt/AUTOEXEC.BAT
echo "%RAMD%:\format c: /s /autotest" >> /mnt/AUTOEXEC.BAT
echo "fdisk /mbr" >> /mnt/AUTOEXEC.BAT
unix2dos /mnt/AUTOEXEC.BAT
umount /mnt

Spoiler

root@openmediavault:/disk# mount /disk/win98floppy.img /mnt
root@openmediavault:/disk# sed -i 's/menudefault=CD,30/menudefault=NOCD,1/g' /mnt/CONFIG.SYS

root@openmediavault:/disk# dos2unix /mnt/AUTOEXEC.BAT
dos2unix: converting file /mnt/AUTOEXEC.BAT to Unix format...
root@openmediavault:/disk# echo "%RAMD%:\format c: /s /autotest" >> /mnt/AUTOEXEC.BAT
root@openmediavault:/disk# echo "fdisk /mbr" >> /mnt/AUTOEXEC.BAT
root@openmediavault:/disk# unix2dos /mnt/AUTOEXEC.BAT
unix2dos: converting file /mnt/AUTOEXEC.BAT to DOS format...
root@openmediavault:/disk# umount /mnt

d) Let DOSBox format the partition for you using the floppy image modified in step c : and close DOSBox once format has finished .
dosbox -c "mount d /disk" -c "d:" -c "imgmount 2 \"newc.img\" -size 512,63,16,1024 -t hdd -fs none" -c "boot \"win98floppy.img\""

format.png
Filename
format.png
File size
7.78 KiB
Views
513 views
File license
Public domain
Spoiler

e) Copy the HD image to the folder you want to use and generate the ISO file
cp /disk/newc.img /outiso/
genisoimage -b newc.img -hard-disk-boot -o /disk/new.iso /outiso

root@openmediavault:/disk# genisoimage -b newc.img -hard-disk-boot -o /disk/new.iso /outiso
I: -input-charset not specified, using utf-8 (detected in locale settings)
Size of boot image is 1032192 sectors -> Emulating a hard disk
Warning: image size does not match geometry (262080)
1.94% done, estimate finish Wed Jul 28 16:55:32 2021
3.88% done, estimate finish Wed Jul 28 16:55:32 2021
5.81% done, estimate finish Wed Jul 28 16:55:32 2021
7.75% done, estimate finish Wed Jul 28 16:55:32 2021
9.68% done, estimate finish Wed Jul 28 16:55:32 2021
11.62% done, estimate finish Wed Jul 28 16:55:32 2021
13.55% done, estimate finish Wed Jul 28 16:55:32 2021
15.49% done, estimate finish Wed Jul 28 16:55:32 2021
17.43% done, estimate finish Wed Jul 28 16:55:32 2021
19.37% done, estimate finish Wed Jul 28 16:55:32 2021
21.30% done, estimate finish Wed Jul 28 16:55:32 2021
23.24% done, estimate finish Wed Jul 28 16:55:32 2021
25.17% done, estimate finish Wed Jul 28 16:55:32 2021
27.11% done, estimate finish Wed Jul 28 16:55:32 2021
29.05% done, estimate finish Wed Jul 28 16:55:32 2021
30.98% done, estimate finish Wed Jul 28 16:55:32 2021
32.92% done, estimate finish Wed Jul 28 16:55:32 2021
34.86% done, estimate finish Wed Jul 28 16:55:32 2021
36.79% done, estimate finish Wed Jul 28 16:55:32 2021
38.73% done, estimate finish Wed Jul 28 16:55:32 2021
40.66% done, estimate finish Wed Jul 28 16:55:34 2021
42.60% done, estimate finish Wed Jul 28 16:55:34 2021
44.54% done, estimate finish Wed Jul 28 16:55:34 2021
46.48% done, estimate finish Wed Jul 28 16:55:34 2021
48.41% done, estimate finish Wed Jul 28 16:55:34 2021
50.35% done, estimate finish Wed Jul 28 16:55:33 2021
52.28% done, estimate finish Wed Jul 28 16:55:33 2021
54.22% done, estimate finish Wed Jul 28 16:55:33 2021
56.15% done, estimate finish Wed Jul 28 16:55:33 2021
58.09% done, estimate finish Wed Jul 28 16:55:33 2021
60.03% done, estimate finish Wed Jul 28 16:55:33 2021
61.97% done, estimate finish Wed Jul 28 16:55:33 2021
63.90% done, estimate finish Wed Jul 28 16:55:33 2021
65.84% done, estimate finish Wed Jul 28 16:55:33 2021
67.77% done, estimate finish Wed Jul 28 16:55:33 2021
69.71% done, estimate finish Wed Jul 28 16:55:33 2021
71.64% done, estimate finish Wed Jul 28 16:55:33 2021
73.58% done, estimate finish Wed Jul 28 16:55:33 2021
75.52% done, estimate finish Wed Jul 28 16:55:33 2021
77.46% done, estimate finish Wed Jul 28 16:55:33 2021
79.39% done, estimate finish Wed Jul 28 16:55:33 2021
81.33% done, estimate finish Wed Jul 28 16:55:33 2021
83.26% done, estimate finish Wed Jul 28 16:55:33 2021
85.20% done, estimate finish Wed Jul 28 16:55:33 2021
87.13% done, estimate finish Wed Jul 28 16:55:33 2021
89.07% done, estimate finish Wed Jul 28 16:55:33 2021
91.01% done, estimate finish Wed Jul 28 16:55:33 2021
92.95% done, estimate finish Wed Jul 28 16:55:33 2021
94.88% done, estimate finish Wed Jul 28 16:55:33 2021
96.82% done, estimate finish Wed Jul 28 16:55:33 2021
98.75% done, estimate finish Wed Jul 28 16:55:33 2021
Total translation table size: 2048
Total rockridge attributes bytes: 0
Total directory bytes: 156
Path table size(bytes): 10
Max brk space used 0
258224 extents written (504 MB)

Spoiler

Of course, if one wants to add files to the HDD the image prior to creating the ISO, mount the image through a loop device and copying files to it is possible as is using MTOOLS, if desired (no offset specify in either case as no DOSEMu header). I chose a 504MB image size as that is the biggest size that is mountable is DOSBox without resorting to fudging head/cylinder values (i.e. doubling the number of heads and halving the number of cylinders to keep cylinder count at 1024 or less) .

Also, it seems that multi-partition disk images cannot be used to create a bootable HDD image on an ISO using genisoimage (mkisofs successor). Whether this a limitation of the El Torito spec or of genisoimage I do not know .

root@openmediavault:/disk# genisoimage -b c.img -hard-disk-boot -o new.iso /outiso
I: -input-charset not specified, using utf-8 (detected in locale settings)
Size of boot image is 1252944 sectors -> Emulating a hard disk
Warning: image size does not match geometry (17316)
genisoimage: Boot image '/outiso/c.img' has multiple partitions.

Reply 24 of 24, by mike_canada

User metadata
Rank Member
Rank
Member
darry wrote on 2021-07-25, 00:12:

Glad you got it to work and thanks for sharing the steps.

Just a question as to what distro/release you are using as compiling the latest release of the original DOSEMU on current Debian is, to put it mildly, less than fun .

Slackware 14.0 32-bit and I downloaded the latest dosemu 1.4