From a0398e7318e1a8e13c163984968c8990f61c9667 Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Thu, 31 Oct 2024 13:47:56 -0700 Subject: [PATCH 1/2] Add 'buildimages.sh fast' for fast uncompressed builds for emulator testing Add dosbox.sh for PC-98 image testing Fix qemu.sh for macOS Enhance emu86.sh for use after buildimages.sh --- buildimages.sh | 62 ++++++++++++++++++--- dosbox.sh | 17 ++++++ emu86.sh | 5 ++ image/Make.image | 1 + pc98-1232-nc.config | 130 ++++++++++++++++++++++++++++++++++++++++++++ qemu.sh | 4 +- 6 files changed, 208 insertions(+), 11 deletions(-) create mode 100755 dosbox.sh create mode 100644 pc98-1232-nc.config diff --git a/buildimages.sh b/buildimages.sh index 1fad85263..470edfb28 100755 --- a/buildimages.sh +++ b/buildimages.sh @@ -1,5 +1,7 @@ # # This script is used to build all ELKS images outside Github CI +# Usage: ./buildimages [fast|ibm] +# The 'fast' option skips initial make clean, pc98-1440 and ibm-all images uncompressed set -x set -e @@ -22,41 +24,83 @@ build_pc98() cp pc98-1232.config .config make mv image/fd1232.img image/fd1232-pc98.img +} +build_pc98_fast() +{ + cleanup + cp pc98-1232-nc.config .config + make + mv image/fd1232.img image/fd1232-pc98.img +} + +build_pc98_1440() +{ cleanup cp pc98-1440.config .config make mv image/fd1440.img image/fd1440-pc98.img } -# build 8018X image -build_8018x() +# build 8018X rom image +build_rom_8018x() { cleanup cp 8018x.config .config make + cp -p elks/arch/i86/boot/Image image/rom-8018x.bin mv image/romfs.bin image/romfs-8018x.bin } +# build 8088 rom image +build_rom_8088() +{ + cleanup + cp emu86-rom-full.config .config + make + cp -p elks/arch/i86/boot/Image image/rom-8088.bin + mv image/romfs.bin image/romfs-8088.bin +} + # build IBM PC versions build_ibm() { cleanup cp ibmpc-1440.config .config - #cp ibmpc-1440-nc.config .config make +} + +build_ibm_fast() +{ + cleanup + cp ibmpc-1440-nc.config .config + make +} +build_ibm_all() +{ cd image make images cd .. } +# quick kernel-only and specific apps build for dosbox, emu86.sh and qemu.sh testing +if [ "$1" == "fast" ]; then + build_pc98_fast + build_rom_8088 + build_ibm_fast + exit +fi + +if [ "$1" == "ibm" ]; then + build_ibm_fast + exit +fi + +# full (re)build including C library and all applications make clean -build_ibm build_pc98 build_8018x - -cp ibmpc-1440.config .config -#cp ibmpc-1440-nc.config .config -cleanup -make +build_8088 +build_ibm +build_ibm_all diff --git a/dosbox.sh b/dosbox.sh new file mode 100755 index 000000000..fb97e05c2 --- /dev/null +++ b/dosbox.sh @@ -0,0 +1,17 @@ +# Helper to run PC98 images in DosBoxX (dosbox-x-sdl2) +# + +# 1232k image from './buildimages.sh fast' +exec ./dosbox-x-sdl2 -set machine=pc98 -set "dosbox quit warning=false" -fastlaunch -c "boot image/fd1232-pc98.img" + +# just-built 1232k image +#exec ./dosbox-x-sdl2 -set machine=pc98 -set "dosbox quit warning=false" -fastlaunch -c "boot image/fd1232.img" + +# 1440k image +#exec ./dosbox-x-sdl2 -set machine=pc98 -set "dosbox quit warning=false" -fastlaunch -c "boot image/fd1440-pc98.img" + +# 1440k IBM image +#exec ./dosbox-x-sdl2 -set "dosbox quit warning=false" -fastlaunch -c "boot image/fd1440.img" + +# 2880k IBM image +#exec ./dosbox-x-sdl2 -set "dosbox quit warning=false" -fastlaunch -c "boot image/fd2880-fat.img" diff --git a/emu86.sh b/emu86.sh index ef06ce12e..5a3b66b87 100755 --- a/emu86.sh +++ b/emu86.sh @@ -6,11 +6,16 @@ # For ELKS ROM Configuration: # ELKS must be configured minimally with 'cp emu86-rom.config .config' +# or use './buildimages.sh fast' # This uses headless console, HLT on idle, ROM filesystem. # Kernel image @ segment 0xE000 (as 64K BIOS extension) # Root filesystem @ segment 0x8000 (assumes 512K RAM & 512K ROM) +# 8088 version using emu-rom-full.config from './buildimages.sh fast' +exec emu86 -w 0xe0000 -f image/rom-8088.bin -w 0x80000 -f image/romfs-8088.bin ${1+"$@"} + +# just built rom version using 'make' exec emu86 -w 0xe0000 -f elks/arch/i86/boot/Image -w 0x80000 -f image/romfs.bin ${1+"$@"} # For ELKS Full ROM Configuration: diff --git a/image/Make.image b/image/Make.image index de12a3328..b206f36d1 100644 --- a/image/Make.image +++ b/image/Make.image @@ -143,3 +143,4 @@ romfs: -rm -f romfs.devices $(MAKE) -f Make.devices "MKDEV=echo >> romfs.devices" mkromfs -d romfs.devices $(DESTDIR) + -rm -f romfs.devices diff --git a/pc98-1232-nc.config b/pc98-1232-nc.config new file mode 100644 index 000000000..d9b4d148b --- /dev/null +++ b/pc98-1232-nc.config @@ -0,0 +1,130 @@ +# +# Automatically generated by make menuconfig: don't edit. +# + + +# +# Kernel & Hardware +# + + +# +# System +# + +# CONFIG_ARCH_IBMPC is not set +# CONFIG_ARCH_8018X is not set +CONFIG_ARCH_PC98=y + +# +# Kernel settings +# + +CONFIG_BOOTOPTS=y +# CONFIG_ASYNCIO is not set +CONFIG_CPU_USAGE=y +CONFIG_TIME_RTC_LOCALTIME=y +CONFIG_TIME_TZ="JST-9" +# CONFIG_TRACE is not set +# CONFIG_TIMER_INT0F is not set +# CONFIG_TIMER_INT1C is not set +CONFIG_FARTEXT_KERNEL=y + +# +# Networking Support +# + +CONFIG_SOCKET=y +# CONFIG_NANO is not set +CONFIG_INET=y +# CONFIG_UNIX is not set + +# +# Filesystem Support +# + +CONFIG_MINIX_FS=y +# CONFIG_ROMFS_FS is not set +CONFIG_FS_FAT=y +CONFIG_FS_EXTERNAL_BUFFER=y +CONFIG_FS_NR_EXT_BUFFERS=64 +# CONFIG_FS_XMS_BUFFER is not set +CONFIG_EXEC_COMPRESS=y +CONFIG_EXEC_OS2=y +CONFIG_EXEC_MMODEL=y + +# +# Drivers +# + + +# +# Block device drivers +# + +CONFIG_BLK_DEV_BFD=y +# CONFIG_BLK_DEV_FD is not set +CONFIG_TRACK_CACHE=y +# CONFIG_BLK_DEV_BFD_HARD is not set +CONFIG_BLK_DEV_BHD=y +# CONFIG_IDE_PROBE is not set +# CONFIG_BLK_DEV_RAM is not set +CONFIG_BLK_DEV_SSD_NONE=y +CONFIG_BLK_DEV_CHAR=y + +# +# Character device drivers +# + +CONFIG_CONSOLE_DIRECT=y +# CONFIG_CONSOLE_BIOS is not set +# CONFIG_CONSOLE_8018X is not set +# CONFIG_CONSOLE_HEADLESS is not set +# CONFIG_KEYBOARD_SCANCODE is not set +# CONFIG_CONSOLE_SERIAL is not set +CONFIG_EMUL_ANSI=y +# CONFIG_KEYMAP_BE is not set +# CONFIG_KEYMAP_DE is not set +# CONFIG_KEYMAP_DV is not set +# CONFIG_KEYMAP_ES is not set +# CONFIG_KEYMAP_FR is not set +# CONFIG_KEYMAP_IT is not set +# CONFIG_KEYMAP_SE is not set +# CONFIG_KEYMAP_UK is not set +CONFIG_KEYMAP_US=y +CONFIG_CHAR_DEV_RS=y +CONFIG_CHAR_DEV_LP=y +CONFIG_CHAR_DEV_MEM=y +CONFIG_PSEUDO_TTY=y + +# +# Network device drivers +# + +# CONFIG_ETH is not set + +# +# Userland +# + +CONFIG_APPS_BY_IMAGESZ=y +CONFIG_APPS_1232K=y +# CONFIG_APPS_FTRACE is not set +# CONFIG_APP_OTHER is not set +# CONFIG_APP_TEST is not set +# CONFIG_APP_MAN_PAGES is not set +# CONFIG_SYS_DEFSHELL_SASH is not set +# CONFIG_SYS_NO_BININIT is not set + +# +# Target image +# + +# CONFIG_IMG_MINIX is not set +CONFIG_IMG_FAT=y +# CONFIG_IMG_ROM is not set +CONFIG_IMG_FD1232=y +CONFIG_IMG_DEV=y +CONFIG_IMG_BOOT=y +# CONFIG_APPS_COMPRESS is not set +# CONFIG_IMG_EXTRA_IMAGES is not set diff --git a/qemu.sh b/qemu.sh index 60507b435..2ae79149a 100755 --- a/qemu.sh +++ b/qemu.sh @@ -112,10 +112,10 @@ NET="-netdev user,id=mynet,$FWD -device ne2k_isa,irq=12,netdev=mynet" # Enable PC-Speaker here: #AUDIO="-audiodev pa,id=speaker -machine pcspk-audiodev=speaker" -UNAME=`uname -a` +UNAME=`uname` # Determine display type ("Darwin" = OSX) -[ $UNAME != 'Darwin' ] && QDISPLAY="-display sdl" +[ "$UNAME" != 'Darwin' ] && QDISPLAY="-display sdl" # Configure QEMU as pure ISA system From b1b96cbc588bac483f84a48e37e04ce82d54eb2d Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Thu, 31 Oct 2024 14:38:10 -0700 Subject: [PATCH 2/2] Use calculations in config.h for DMASEGSZ and DMASEGEND --- elks/include/linuxmt/config.h | 72 ++++++++++++++--------------------- 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/elks/include/linuxmt/config.h b/elks/include/linuxmt/config.h index 0d5cac6e6..8c94b84c3 100644 --- a/elks/include/linuxmt/config.h +++ b/elks/include/linuxmt/config.h @@ -7,6 +7,8 @@ /* * Compile-time configuration */ +#define UTS_SYSNAME "ELKS" /* uname system name */ +#define UTS_NODENAME "elks" /* someday set by sethostname() */ #define CONFIG_MSDOS_PARTITION 1 /* support DOS HD partitions */ #define CONFIG_FS_DEV 1 /* support FAT /dev folder */ @@ -28,7 +30,7 @@ #define SETUP_PART_OFFSETLO setupw(0x1e2) /* partition offset low word */ #define SETUP_PART_OFFSETHI setupw(0x1e4) /* partition offset high word */ #ifdef CONFIG_ROMCODE -#define SYS_CAPS (CAP_PC_AT) +#define SYS_CAPS (CAP_PC_AT) #endif #define UTS_MACHINE "ibmpc i8086" @@ -101,66 +103,48 @@ #define DEF_SETUPSEG DEF_INITSEG + 0x20 #define DEF_SYSMAX 0x2F00 /* maximum system size (=.text+.fartext+.data) */ -/* DMASEG is a bounce buffer of 1K (=BLOCKSIZE) below the first 64K boundary (=0x1000:0) - * for use with the old 8237 DMA controller OR a disk track buffer of 9K (18 ectors). - * Following that is the kernel code and data at REL_INITSYS. +/* Segmemnt DMASEG up to DMASEGEND is used as a bounce buffer of at least 1K (=BLOCKSIZE) + * below the first 64K boundary (=0x1000:0) for use with the old 8237 DMA controller. + * If floppy track caching is enabled, this area is also used for the track buffer + * for direct DMA access using multisector I/O. + * Following DMASEGEND is the kernel code and data at REL_SYSSEG. */ -#ifdef CONFIG_ROMCODE -#if defined(CONFIG_BLK_DEV_BFD) || defined(CONFIG_BLK_DEV_BHD) /* BIOS disk driver*/ -#define DMASEG 0x80 /* 0x400 bytes floppy sector buffer */ -#ifdef CONFIG_TRACK_CACHE /* floppy track buffer in low mem */ -#define DMASEGSZ 0x2400 /* SECTOR_SIZE * 18 (9216) */ -#define KERNEL_DATA 0x2C0 /* kernel data segment */ +#ifdef CONFIG_TRACK_CACHE /* floppy track buffer in low mem */ +#define DMASEGSZ 0x2400 /* SECTOR_SIZE * 18 (9216) */ #else -#define DMASEGSZ 0x040 /* BLOCK_SIZE (1024) */ -#define KERNEL_DATA 0x0C0 /* kernel data segment */ +#define DMASEGSZ 0x0400 /* BLOCK_SIZE (1024) */ #endif +#define DMASEGEND (DMASEG+(DMASEGSZ>>4)) + +#ifdef CONFIG_ROMCODE +#if defined(CONFIG_BLK_DEV_BFD) || defined(CONFIG_BLK_DEV_BHD) /* BIOS disk driver*/ +#define DMASEG 0x80 /* 0x400 bytes floppy sector buffer */ +#define KERNEL_DATA DMASEGEND /* kernel data segment */ #else -#define KERNEL_DATA 0x80 /* kernel data segment */ +#define KERNEL_DATA 0x080 /* kernel data segment */ #endif #define SETUP_DATA CONFIG_ROM_SETUP_DATA #endif - #if (defined(CONFIG_ARCH_IBMPC) || defined(CONFIG_ARCH_8018X)) && !defined(CONFIG_ROMCODE) /* Define segment locations of low memory, must not overlap */ -#define DEF_OPTSEG 0x50 /* 0x200 bytes boot options*/ -#define OPTSEGSZ 0x200 /* max size of /bootopts file (1K max) */ -#define REL_INITSEG 0x70 /* 0x200 bytes setup data */ -#define DMASEG 0x90 /* 0x400 bytes floppy sector buffer */ -#ifdef CONFIG_TRACK_CACHE /* floppy track buffer in low mem */ -#define DMASEGSZ 0x2400 /* SECTOR_SIZE * 18 (9216) */ -#define REL_SYSSEG 0x2D0 /* kernel code segment */ -#else -#define DMASEGSZ 0x0400 /* BLOCK_SIZE (1024) */ -#define REL_SYSSEG 0x0D0 /* kernel code segment */ -#endif +#define OPTSEGSZ 0x200 /* max size of /bootopts file (512 bytes max) */ +#define DEF_OPTSEG 0x50 /* 0x200 bytes boot options at lowest usable ram */ +#define REL_INITSEG 0x70 /* 0x200 bytes setup data */ +#define DMASEG 0x90 /* start of floppy sector buffer */ +#define REL_SYSSEG DMASEGEND /* kernel code segment */ #define SETUP_DATA REL_INITSEG #endif - #if defined(CONFIG_ARCH_PC98) && !defined(CONFIG_ROMCODE) /* Define segment locations of low memory, must not overlap */ -#define DEF_OPTSEG 0x60 /* 0x200 bytes boot options*/ -#define OPTSEGSZ 0x200 /* max size of /bootopts file (1K max) */ -#define REL_INITSEG 0x80 /* 0x200 bytes setup data */ -#define DMASEG 0xA0 /* 0x400 bytes floppy sector buffer */ -#ifdef CONFIG_TRACK_CACHE /* floppy track buffer in low mem */ -#define DMASEGSZ 0x2400 /* SECTOR_SIZE * 18 (9216) > SECTOR_SIZE * 8 (8192) */ -#define REL_SYSSEG 0x2E0 /* kernel code segment */ -#else -#define DMASEGSZ 0x0400 /* BLOCK_SIZE (1024) */ -#define REL_SYSSEG 0x0E0 /* kernel code segment */ -#endif +#define OPTSEGSZ 0x200 /* max size of /bootopts file (512 bytes max) */ +#define DEF_OPTSEG 0x60 /* 0x200 bytes boot options at lowest usable ram */ +#define REL_INITSEG 0x80 /* 0x200 bytes setup data */ +#define DMASEG 0xA0 /* start of floppy sector buffer */ +#define REL_SYSSEG DMASEGEND /* kernel code segment */ #define SETUP_DATA REL_INITSEG #endif -/* Defines for what uname() should return. - * The definitions for UTS_RELEASE and UTS_VERSION are now passed as - * kernel compilation parameters, and should only be used by elks/kernel/version.c - */ -#define UTS_SYSNAME "ELKS" -#define UTS_NODENAME "elks" /* someday set by sethostname() */ - #endif