FreeDOS: Difference between revisions

From Leo's Notes
This page was last edited on 10 August 2017, at 16:58.
Line 98: Line 98:


=== iPXE Boot ===
=== iPXE Boot ===
For more details, see the [[iPxe]] page.
For more details, see the [[IPXE]] page.


If you do not have a DHCP server set up to do PXE boot (ie, {{code|next-server}} and {{code|filename}} isn't set), you could use iPXE instead to boot FreeDOS via network.
If you do not have a DHCP server set up to do PXE boot (ie, {{code|next-server}} and {{code|filename}} isn't set), you could use iPXE instead to boot FreeDOS via network.

Revision as of 16:58, 10 August 2017

Configuration


Creating Custom FreeDOS Image

To create your own custom FreeDOS image file (such as creating your own BIOS update boot USB/PXE image):

  1. Get FreeDOS
  2. Get the FreeDOS sys-freedos-linux package
  3. Create an empty file of the desired size
  4. Create a msdos filesystem
  5. Load the FreeDOS boot sector image
  6. Copy the FreeDOS files into the image
  7. Copy any additional files to the image
  8. Unmount
## Download FreeDOS (the floppy image works) and mount it.
# wget fdboot.img
# mount fdboot.img freedos

## Create an file for the image. Eg. 10 MB
# dd if=/dev/zero of=freedos.img bs=1024 count=10240
10240+0 records in
10240+0 records out
10485760 bytes (10 MB) copied, 0.232655 s, 45.1 MB/s

## Make the MSDOS filesystem (vfat)
# mkfs.msdos freedos.img
mkfs.vfat 3.0.9 (31 Jan 2010)

## Load the boot sector to the image, requires nasm
# ./sys-freedos.pl --disk=freedos.img
DOS boot sector for freedos.img will be created by:
        nasm -o /dev/stdout -dISFAT16  ./bootsecs/boot.asm
Using FAT16. Partn offset 0, CHS *x64x32  Drive 0, (0x0, 0x29),
SerNo 5C9-916A, Strings '           ',  'FAT16   '.
Boot sector successfully updated.

## Mount and copy the FreeDOS system files over
# mount -o loop -t vfat freedos.img /mnt/freedos
# cp -r freedos/* /mnt/freedos

## Copy any other files over such as BIOS updates. Make any other changes 
# cp -r bios_update.exe /mnt/freedos
# vi /mnt/freedos/AUTOEXEC.BAT  # tweak any other settings as required
# vi /mnt/freedos/CONFIG.SYS  # tweak any other settings as required

## Unmount and deploy.
# umount /mnt/freedos


See Also

Gentoo has a guide outlining how to create a custom FreeDOS environment imaage

PXE Boot FreeDOS

With a custom FreeDOS image created as outlined above, you should be able to PXE boot the image using Syslinux's memdisk.

Assuming that you have all the PXE infrastructure set up (DHCP + TFTP + /tftpboot/pxelinux.cfg), add an entry in the pxelinux.cfg directory containing:

LABEL Dell-BIOS-Update
        MENU LABEL Dell-BIOS-Update
        kernel /images/Dell-BiosUpdate/memdisk
        append initrd=/images/Dell-BiosUpdate/freedos-bios.img

Use the memdisk binary from syslinux.

Dell BIOS updates seem to work only when himem and the emm386 are not loaded. With them loaded, the BIOS update will fail.

My settings for the following files are:

CONFIG.SYS

DOS=HIGH
rem ?DEVICE=\FDOS\HIMEM.EXE /VERBOSE
rem ?DEVICE=\FDOS\EMM386.EXE /VERBOSE
rem ?DEVICE=\UMBPCI.SYS
FILES=20
BUFFERS=20
!rem SHELL=A:\COMMAND.COM /E:512 /MSG /P
SHELLHIGH=\COMMAND.COM /E:256 /P

AUTOEXEC.BAT

@ECHO OFF
CLS
ECHO Welcome to FreeDOS (http://www.freedos.org)!
O9020A19.exe

iPXE Boot

For more details, see the IPXE page.

If you do not have a DHCP server set up to do PXE boot (ie, next-server and filename isn't set), you could use iPXE instead to boot FreeDOS via network.

I was able to boot FreeDOS using the following iPXE embedded script. Note the imgargs values; these are required for a successful boot.

:retry_dhcp
dhcp || goto retry_dhcp

echo Booting FreeDOS BIOS Update

kernel tftp://${netX/next-server}/images/Dell9020-BiosUpdate/memdisk
initrd tftp://${netX/next-server}/images/Dell9020-BiosUpdate/freedos-9020-bios.img
imgargs memdisk raw
boot
Boot from HTTP and other protocols
The previoius example uses tftp, but you can easily use http as well as any other supported protocols your iPXE ROM was compiled with.