Skip to content

Frequent issues

chibicitiberiu edited this page Feb 13, 2024 · 2 revisions

Some solutions to common problems.

Bochs doesn't work

  • instead of stopping at 7C00 (or running the OS), Bochs resets immediately to an FFFFFFFx address: this is usually a problem with the BIOS image. Bochs comes with several BIOS images in /usr/share/bochs, you can try a different one. Note that some BIOS images have a different size, you can calculate the address as 0x100000000 - file_size_in_hex.

  • OS boots, but I don't see an image: this can be a problem with the GUI frontend or the VGABIOS image. There are several GUI frontends for bochs, such as x, wx or sdl2 (in Ubuntu, there are separate packages for each, e.g. bochs-x, bochs-wx). If you are still having trouble, there are several VGA bios images available in /usr/share/vgabios/ that you can try. Alternatively, you can try downloading a newer version of the images from the Bochs website (or repo).

  • error related to gui_frontend: your version of bochs doesn't have the GUI frontend support built. Try to find another version that has it, or try to compile Bochs yourself.

../.toolchains: No such file or directory

./scripts/setup_toolchain.sh: line 34: pushd: ../.toolchains: No such file or directory

You need to either create a .toolchains folder in the folder above where you cloned the repository, or modify the path in build_scripts/config.py.

mkfs.fat: Unrecognized option '--offset=...'

  STDERR:
/usr/sbin/mkfs.fat: unrecognized option '--offset=2048'
Usage: mkfs.fat [-a][-A][-c][-C][-v][-I][-l bad-block-file][-b backup-boot-sector]
       [-m boot-msg-file][-n volume-name][-i volume-id]
       [-s sectors-per-cluster][-S logical-sector-size][-f number-of-FATs]
       [-h hidden-sectors][-F fat-size][-r root-dir-entries][-R reserved-sectors]
       [-M FAT-media-byte][-D drive_number]
       [--invariant]
       [--help]
       /dev/name [blocks]

You are using a version of mkfs.fat that is too old. Try updating it to a more recent version that has the '--offset' flag. Some distributions have a different name for this tool, mkfs.vfat, which might work instead.

Alternative solutions:

  • instead of working directly on the final disk image, create a separate file that represents the disk partition. You can format it without needing --offset, and then you can use dd (or a similar tool) to copy the contents of the file to the final disk image with the correct offset.

  • attach the disk image using losetup, and then you can format it with mkfs.fat ... /dev/loopNp1 (replace N with the device that losetup found).