Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kernel] Enhance buildimages.sh and emulator scripts, add DMASEGEND in config.h #2091

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 53 additions & 9 deletions buildimages.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
17 changes: 17 additions & 0 deletions dosbox.sh
Original file line number Diff line number Diff line change
@@ -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"
72 changes: 28 additions & 44 deletions elks/include/linuxmt/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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"

Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions emu86.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions image/Make.image
Original file line number Diff line number Diff line change
Expand Up @@ -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
130 changes: 130 additions & 0 deletions pc98-1232-nc.config
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading