Building your own, customizable, bootable CD is not a common task. You may never need to do it on your own. If you just want to boot a system - use any of the already pre-build bootable CDs. Here is an incomplete list of some of them:
Not so long ago, I need to get MS-DOS program running on my laptop. Unfortunately, the obvious choice here - virtualization (i.e. VirtualBox, QEMU and others), was not possible. The program needs a PC running DOS compatible operating system as host operating systems. Beside this the program needs access to hardware serial port (no USB to Serial adapters). It also needs RW access to the the file system, which can be only FAT16/FAT32.Therefore I had two choices: to install DOS in separate FAT16/FAT32 partition on the hdd and place the program inside it or build my own, customized bootable CD, which boots DOS and provides virtual disk drive in RAM so there is RW access to it. I decided to go with the bootable CD, since it provides portable solution which can be run on other PCs, without to need to re-partition the drive or install something.
I had some basic knowledge on booting process of x86 system and expected there is some kind of tool suite that would let me prepare the CD in few minutes. Unfortunately it wasn't that easy. Following the tutorial from UBCD project: http://www.hiren.info/pages/bootablecd, I was able to build a bootbale CD very easy but for some reasons the provided MSCDEX driver (this is the DOS driver for CDROM support) can not recognize the CDROM of my laptop. It works fine in VirtualBox but not in the "real world". I tried with another driver but still no success. I suspect that problem here is the CDROM of the laptop, but I had to overcome it somehow. Obviously I need to read for a while and find better solution ...
After reading some wikis and blogs, I got the answers. There is lot of information but it was not collected in a single place. So here I will try to provide brief explanation how to create bootable CD with FreeDOS. My choice for a bootloader for the bootable CD is the syslinux/isolinux (http://www.syslinux.org/wiki/index.php/The_Syslinux_Project). I believe this is most flexible solution I've discovered. Syslinux can be used to boot any OS from a HDD, while isolinux is used with a CD. The combination of isolinux bootloader and memdisk module can provide bootable CD which creates virtual RAM drive wich have read write access. The virtual drive is fullfiled with image file, containing file system. The image file can be build in many ways, in particular I used QEMU emulator and UBCD bootable cd used as installation CD for the FreeDOS. The image contains FAT16 file system with installed FreeDOS operating system plus the program I need to run. The final step was mkiso utility which actually builds the iso file.
Tools required:
1. isolinux
2. QEMU
3. mkisofs
4. UBCD iso file
Step by step guide:
1. Create image file with QEMU. Following command will create 20MByte image file.
2. Install DOS compatible operating system. I used the UBCD as install CD for FreeDOS. Booting virtual PC with previously created image file as hard disk and UBCD iso file as CDROM can be done with the command:
Before DOS installation I need to partition disk (i.e. the image file) and format the partitions. I used XFDISK from UBCD:
Installation of the FreeDOS was rather simple. It was done by booting the FreeDOS (from UBCD):
and executing following commands:
For those one of you, who had used DOS operating systems before, these commands should be pretty clear. The format command performs partition formating, the sys command performs actual system installation. Basic install includes only modification of MBR and files: io.sys and msdos.sys. So here some additonal 9and optional) files are copied: drivers for high memory, extended memory and text editor.
If you need access to the file system from Linux, you are lucky:
That's why I love Linux, try to do this within Windows ..... :)
I created two files in the root directory of the image file: config.sys and autoexec.bat. The contents of config.sys is:
The file autoexec.bat contains commands which are executed during startup (for an example you can run any program you need to). I left it empry. Be aware for line endings in autoexec.bat and config.sys - unlike linux text files, they must end with CR LF!
3. Install bootloader and memdisk module. This is done by following commands:
Configuration file for the bootloader (iso/isolinux/isolinux.cfg) should have following contents:
4. Create iso file. This is done with mkiso utility:
5. Test the image file. You can use QEMU to test iso file before burning it:
6. Burn the iso file.
Well ...that was not that hard, right? :) Go and try it.
Some useful references:
http://en.wikibooks.org/wiki/QEMU/FreeDOS
http://www.syslinux.org/wiki/index.php/SYSLINUX
http://www.syslinux.org/wiki/index.php/MEMDISK
http://www.syslinux.org/wiki/index.php/Doc/isolinux
http://www.earth.li/~noodles/blog/2011/06/building-a-freedos-bootable-us.html
http://riskofruin.markmccracken.net/2011/02/booting-custom-isos-with-syslinux.html
http://www.nu2.nu/bootcd/
- http://www.ubuntu.com/download/desktop
- http://www.ultimatebootcd.com/download.html
- http://www.damnsmalllinux.org/download.html
Not so long ago, I need to get MS-DOS program running on my laptop. Unfortunately, the obvious choice here - virtualization (i.e. VirtualBox, QEMU and others), was not possible. The program needs a PC running DOS compatible operating system as host operating systems. Beside this the program needs access to hardware serial port (no USB to Serial adapters). It also needs RW access to the the file system, which can be only FAT16/FAT32.Therefore I had two choices: to install DOS in separate FAT16/FAT32 partition on the hdd and place the program inside it or build my own, customized bootable CD, which boots DOS and provides virtual disk drive in RAM so there is RW access to it. I decided to go with the bootable CD, since it provides portable solution which can be run on other PCs, without to need to re-partition the drive or install something.
I had some basic knowledge on booting process of x86 system and expected there is some kind of tool suite that would let me prepare the CD in few minutes. Unfortunately it wasn't that easy. Following the tutorial from UBCD project: http://www.hiren.info/pages/bootablecd, I was able to build a bootbale CD very easy but for some reasons the provided MSCDEX driver (this is the DOS driver for CDROM support) can not recognize the CDROM of my laptop. It works fine in VirtualBox but not in the "real world". I tried with another driver but still no success. I suspect that problem here is the CDROM of the laptop, but I had to overcome it somehow. Obviously I need to read for a while and find better solution ...
After reading some wikis and blogs, I got the answers. There is lot of information but it was not collected in a single place. So here I will try to provide brief explanation how to create bootable CD with FreeDOS. My choice for a bootloader for the bootable CD is the syslinux/isolinux (http://www.syslinux.org/wiki/index.php/The_Syslinux_Project). I believe this is most flexible solution I've discovered. Syslinux can be used to boot any OS from a HDD, while isolinux is used with a CD. The combination of isolinux bootloader and memdisk module can provide bootable CD which creates virtual RAM drive wich have read write access. The virtual drive is fullfiled with image file, containing file system. The image file can be build in many ways, in particular I used QEMU emulator and UBCD bootable cd used as installation CD for the FreeDOS. The image contains FAT16 file system with installed FreeDOS operating system plus the program I need to run. The final step was mkiso utility which actually builds the iso file.
Tools required:
1. isolinux
2. QEMU
3. mkisofs
4. UBCD iso file
Step by step guide:
1. Create image file with QEMU. Following command will create 20MByte image file.
qemu-img create -f raw dos.img 20M
2. Install DOS compatible operating system. I used the UBCD as install CD for FreeDOS. Booting virtual PC with previously created image file as hard disk and UBCD iso file as CDROM can be done with the command:
qemu visa.img -cdrom ubcd511.iso -boot d
Before DOS installation I need to partition disk (i.e. the image file) and format the partitions. I used XFDISK from UBCD:
Installation of the FreeDOS was rather simple. It was done by booting the FreeDOS (from UBCD):
and executing following commands:
a:
format c:
sys c:
copy a:\bin\emm386.exe c:\
copy a:\bin\himem.exe c:\
copy q:\bin/edit.com c:\
For those one of you, who had used DOS operating systems before, these commands should be pretty clear. The format command performs partition formating, the sys command performs actual system installation. Basic install includes only modification of MBR and files: io.sys and msdos.sys. So here some additonal 9and optional) files are copied: drivers for high memory, extended memory and text editor.
If you need access to the file system from Linux, you are lucky:
sudo mount -o loop,offset=32256 dos.img /mnt
That's why I love Linux, try to do this within Windows ..... :)
I created two files in the root directory of the image file: config.sys and autoexec.bat. The contents of config.sys is:
device=c:\himem.exe
dos=high,umb
device=c:\emm362.exe noems
files=20
The file autoexec.bat contains commands which are executed during startup (for an example you can run any program you need to). I left it empry. Be aware for line endings in autoexec.bat and config.sys - unlike linux text files, they must end with CR LF!
3. Install bootloader and memdisk module. This is done by following commands:
mkdir iso
mkdir iso/isolinux
cp /usr/lib/syslinux/isolinux.bin iso/isolinux/
cp /usr/lib/syslinux/memdisk iso/isolinux/
Configuration file for the bootloader (iso/isolinux/isolinux.cfg) should have following contents:
default dos
timeout 1
label dos
linux memdisk
append initrd=/dos.img
4. Create iso file. This is done with mkiso utility:
cd iso
mkiso -o ../dos.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-tabl
5. Test the image file. You can use QEMU to test iso file before burning it:
qemu -cdrom ../dos.iso -boot d
Well ...that was not that hard, right? :) Go and try it.
Some useful references:
http://en.wikibooks.org/wiki/QEMU/FreeDOS
http://www.syslinux.org/wiki/index.php/SYSLINUX
http://www.syslinux.org/wiki/index.php/MEMDISK
http://www.syslinux.org/wiki/index.php/Doc/isolinux
http://www.earth.li/~noodles/blog/2011/06/building-a-freedos-bootable-us.html
http://riskofruin.markmccracken.net/2011/02/booting-custom-isos-with-syslinux.html
http://www.nu2.nu/bootcd/