User Tools

Site Tools


blog:pushbx:2023:0706_how_to_set_up_dosemu2_freedos_and_ldebug

How to set up dosemu2, FreeDOS, and lDebug

I got to set up the lDebug development environment on a new Debian 12 installation on the amd64 machine. (The SSD seems to have caused crashes recently, and it had the root file system of the prior Debian installation.) Here's how I installed dosemu2 (from source), FreeDOS (from packages plus my recent kernel and FreeCOM builds), and lDebug (from assembly source).

Install needed packages

Install the following packages using synaptic: (many based on dosemu2's current INSTALL file)

  • git
  • gitk
  • gcc
  • autoconf
  • bison
  • flex
  • libjson-c-dev
  • libc6-dev
  • libfluidsynth-dev
  • libsdl2-dev
  • libslang2-dev
  • libslirp-dev
  • libgpm-dev
  • alsa-oss
  • alsa-tools
  • ladspa-sdk
  • libao-dev
  • libudev-dev
  • libxext-dev
  • make
  • gawk
  • libbsd-dev

Install these packages too:

  • mercurial
  • diffuse
  • mercurial-crecord
  • tortoisehg
  • tortoisehg-caja
  • mtools
  • halibut
  • nasm
  • dos2unix
  • qemu-system-x86
  • python3-tqdm (needed for install-freedos)
  • clang (needed to build lzsa)
  • lrzsz
  • picocom
  • socat

Clone repos

Building dosemu2

Enter directory ~/proj/dosemu2 and run:

./autogen.sh
./default-configure --disable-fdpp
make
sudo make install

Set up DOS

Make directory ~/.dosemu/drive_c and download:

Enter directory ~/proj/install-freedos/ and enter commands: (Probably not all needed, this is just what worked for me.)

cd src
./dosemu-downloaddos -o freedos13
./dosemu-downloaddos -o freedos13userspace
./dosemu-setupfreedos
./dosemu-installfreedosuserspace

In directory ~/.dosemu/drive_c create symlinks:

ln -s ../command.com bin/command.com
ln -s ../sys.com bin/sys.com

Enter directory /usr/local/share/dosemu/dosemu2-cmds-0.3/ and run:

cp -ia fdppconf.sys ~/.dosemu/drive_c/fdconfig.sys
cp -ia fdautoem.bat ~/.dosemu/drive_c
nano ~/.dosemu/drive_c/fdconfig.sys
nano ~/.dosemu/drive_c/fdautoem.bat

Contents of file fdconfig.sys edited to read:

device=d:\dosemu\umb.sys
devicehigh=d:\dosemu\ems.sys
SWITCHES=/F
DOS=UMB
dosdata=umb
fileshigh=128
lastdrive=Z
rem emufs.sys /all replaces emufs.com
devicehigh=d:\dosemu\emufs.sys /all
devicehigh=d:\dosemu\cdrom.sys
set SHELL_ALLOW_EXIT=1
shellhigh=c:\command.com /p:fdautoem.bat

Contents of file fdautoem.bat (not edited):

@echo off
rem autoexec.bat for DOSEMU + FreeDOS
path d:\dosemu
rem this is needed when booting from dosemu-freedos-bin
if exist f:\gnu\nul path %PATH%;f:\bin;f:\gnu
if exist c:\bin\nul path %PATH%;c:\bin
set HELPPATH=f:\help
if exist c:\help\nul set HELPPATH=c:\help
if exist e:\tmp\nul call swapdrv.bat c: e:
set TEMP=c:\tmp
if not exist %TEMP%\nul mkdir %TEMP%
emusound -e
emumouse c 1
prompt $P$G
rem uncomment to load another bitmap font
rem lh display con=(vga,437,2)
rem mode con codepage prepare=((850) f:\cpi\ega.cpx)
rem mode con codepage select 850
rem chcp 850
echo Welcome to dosemu2!
system -s DOSEMU_VERSION
echo     Build %DOSEMU_VERSION%
call exechlp.bat -ep

Build and configure lDebug

Setup ~/.hgrc

In ~/proj/lzsa run make and symlink lzsa executable into path.

In ~/proj/tellsize compile program and place executable tellsize in path.

In ~/proj/ldebug/source copy cfg.sh to ovr.sh and edit line setting INICOMP_METHOD to set it to only lzsa2.

Build several lDebug builds:

./mak.sh
./makerd
build_name=cdebugx build_options="-D_DEBUG -D_DEBUG_COND -D_PM" ./mak.sh
build_name=cdebug build_options="-D_DEBUG -D_DEBUG_COND -D_PM=0" ./mak.sh

Enter directory ~/.dosemu/drive_c/bin and create symlinks:

ln -s ../../../proj/ldebug/bin/ldebug.com
ln -s ../../../proj/ldebug/bin/ldebugu.com
ln -s ../../../proj/ldebug/bin/lddebugu.com
ln -s ../../../proj/ldebug/bin/lddebug.com
ln -s ../../../proj/ldebug/bin/lcdebug.com
ln -s ../../../proj/ldebug/bin/lcdebugu.com
ln -s ../../../proj/ldebug/bin/lcdebugx.com

Create a configuration with the following contents (also in ~/.dosemu/drive_c/bin):

@:applicationstartup
@:devicestartup
@install getinput
@?version

Using these commands:

nano ldebug.sld
ln -s ldebug.sld lcdebug.sld
ln -s ldebug.sld lddebug.sld

Final set up

In DOS run sys config c:\kernel.sys checkdebugger=1

Symlink ~/.dosemu/drive_c/rxdos.com to an lDebug executable in order to bootload the debugger.

Open question

This is the output of booting (dosemu -t):

dosemu2 2.0pre9-dev-20230704-1320-g3b250d8d0 Configured: 2023-07-06 10:08:54 +0000
Get the latest code at http://dosemu2.github.io/dosemu2
Submit Bugs via https://github.com/dosemu2/dosemu2/issues
Ask for help in mail list: linux-msdos@vger.kernel.org
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, GPL v2 (or any later version) distribution conditions.

FreeDOS kernel - GIT (build 2043 OEM:0xfd) [compiled Jul  3 2023]
Kernel compatibility 7.10 - GNUC - FAT32 support

(C) Copyright 1995-2022 Pasquale J. Villani and The FreeDOS Project.
All Rights Reserved. This is free software and comes with ABSOLUTELY NO
WARRANTY; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation;
either version 2, or (at your option) any later version.
C: HD1, Pri[ 1], CHS=    0-1-1, start=     0 MB, size=  2000 MB
D: HD2, Pri[ 1], CHS=    0-1-1, start=     0 MB, size=  2000 MB
dosemu XMS 3.0 & UMB support enabled
UMBs unavailable!
dosemu EMS driver rev 0.9 installed.
UMBs unavailable!
EMUFS host file and print access available
dosemu CDROM driver installed (V0.2)

FreeCom version 0.85a - GNUC - XMS_Swap [Mar 31 2023 23:40:37]
BLASTER=A220 I5 D1 H5 P300 T6
MIDI=SYNTH:2 MAP:E MODE:0
Welcome to dosemu2!
    Build 2.0pre9-dev-20230704-1320-g3b250d8d0
C:\>

I don't know what exactly displays the two "UMBs unavailable!" lines and why. If I boot into the debugger then enter boot protocol freedos then q, these lines do not appear. Regardless whether they appear, DOS UMBs are set up and used properly.

Discussion

C. MaslochC. Masloch, 2023-07-06 14:32:30 +0200 Jul Thu

Reported a bug in https://github.com/dosemu2/dosemu2/issues/2038

C. MaslochC. Masloch, 2023-07-06 14:41:37 +0200 Jul Thu

Had to edit ovr.sh some more:

[ -z "$use_build_qimg" ] && use_build_qimg=1
[ -z "$use_build_bimg" ] && use_build_bimg=1

Or run ./makqimg.sh manually. Required in order to build the QEMU boot diskette image used by test.py.

C. MaslochC. Masloch, 2023-07-06 14:46:43 +0200 Jul Thu

Had to copy over the ~/.ssh directory from old home file system, and add a line to the [paths] section of ~/proj/ldebug/.hg/hgrc:

default-push = ssh://[username]@pushbx.org/webrepos/ldebug
C. MaslochC. Masloch, 2023-07-06 14:50:32 +0200 Jul Thu
~/proj$ hg clone https://hg.pushbx.org/ecm/dpmitest
~/proj$ cd dpmitest/
~/proj/dpmitest$ nasm dpmimini.asm -o dpmimini.com -l dpmimini.lst -I ../lmacros/
~/proj/ldebug/bin$ ln -s ../../dpmitest/dpmimini.com
C. MaslochC. Masloch, 2023-07-06 14:51:15 +0200 Jul Thu, 2023-07-06 14:51:24 +0200 Jul Thu

The shellhigh line in fdconfig.sys needs to set a higher environment size like /e:2048 otherwise long-ish -E command lines to dosemu2 will fail.

C. MaslochC. Masloch, 2023-07-06 14:55:50 +0200 Jul Thu

Components for building lDebug are listed in https://pushbx.org/ecm/doc/ldebug.htm#buildingcomponents

C. MaslochC. Masloch, 2023-07-07 10:52:09 +0200 Jul Fri

Cloned https://github.com/atomicobject/heatshrink and ran make and symlinked the heatshrink executable into the path, too.

C. MaslochC. Masloch, 2023-07-07 14:41:44 +0200 Jul Fri

Cloned https://hg.pushbx.org/ecm/bdiff.jh and compiled both files and symlinked.

C. MaslochC. Masloch, 2023-07-07 17:44:25 +0200 Jul Fri

Cloned https://github.com/mookid/diffr.git and installed rustc package, then in ~/proj/diffr ran cargo install --path . (This fetches some more crates as they are apparently called.) Then ln -s "$PWD/target/release/diffr" ~/mods/bin/

C. MaslochC. Masloch, 2023-07-07 20:00:48 +0200 Jul Fri

According to https://linuxize.com/post/how-to-add-user-to-group-in-linux/ use:

/usr/sbin/usermod -a -G dialout ecm
/usr/sbin/usermod -a -G kvm ecm
C. MaslochC. Masloch, 2023-07-07 20:17:19 +0200 Jul Fri
cpan install Curses.pm
cpan install Audio/Beep.pm
cpan install Syntax/Keyword/Try.pm
cpan install Switch.pm
cpan install File/HomeDir.pm

Needed for TracList.

C. MaslochC. Masloch, 2023-07-08 01:15:49 +0200 Jul Sat

Installed openssh-server package.

C. MaslochC. Masloch, 2023-07-15 22:06:00 +0200 Jul Sat

Cloned https://github.com/mentalisttraceur/cdexec.git and built using make, then linked into path.

C. MaslochC. Masloch, 2023-07-23 20:52:06 +0200 Jul Sun

Installed GNU time for new feature of lDebug build script.

C. MaslochC. Masloch, 2023-08-12 14:37:51 +0200 Aug Sat
cat ~/.gitconfig
[user]
        email = pushbx@ulukai.org
        name = C. Masloch
C. MaslochC. Masloch, 2023-08-13 19:25:52 +0200 Aug Sun
$ cat ~/.dosemurc 
$_lredir_paths = "/home/ecm"

Needed for the EDR-DOS build.

C. MaslochC. Masloch, 2023-08-26 22:45:24 +0200 Aug Sat

Changed fdconfig.sys line DOS=UMB to read DOS=UMB,high

C. MaslochC. Masloch, 2023-09-11 18:35:45 +0200 Sep Mon

Install libb64-dev now needed by dosemu2: https://github.com/dosemu2/dosemu2/pull/2088#issuecomment-1712921416

C. MaslochC. Masloch, 2023-10-08 19:56:30 +0200 Oct Sun

Install cmake for building Halibut. Then run git clone https://github.com/ecm-pushbx/halibut, change directory into this, run cmake . then run cmake –build .

E. C. MaslochE. C. Masloch, 2024-02-03 18:11:42 +0100 Feb Sat

git clone https://github.com/lz4/lz4 and then make then symlink lz4. This needs the update in https://hg.pushbx.org/ecm/ldebug/rev/156a4890666e

E. C. MaslochE. C. Masloch, 2024-02-26 14:35:25 +0100 Feb Mon

Download exomizer 3.0.2 from https://bitbucket.org/magli143/exomizer/wiki/Home then unzip it into an empty directory. cd src then make then symlink exomizer

E. C. MaslochE. C. Masloch, 2024-02-26 14:51:54 +0100 Feb Mon

git clone https://github.com/emmanuel-marty/apultra.git then cd apultra then make then symlink apultra

You could leave a comment if you were logged in.
blog/pushbx/2023/0706_how_to_set_up_dosemu2_freedos_and_ldebug.txt · Last modified: 2023-12-04 20:47:21 +0100 Dec Mon by ecm