Skip to content

Commit

Permalink
Merge pull request #2100 from ghaerr/bootopts
Browse files Browse the repository at this point in the history
[boot] Expand /bootopts to 1023 bytes
  • Loading branch information
ghaerr authored Nov 14, 2024
2 parents 6e9647a + 3def02f commit b8c9588
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 77 deletions.
7 changes: 4 additions & 3 deletions bootblocks/boot_minix.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
static byte_t sb_block [BLOCK_SIZE]; // super block block buffer
#define sb_data ((struct super_block *)sb_block)

static char linux[] = "/linux";
static int i_now;
static int i_boot;
static int loadaddr;
Expand Down Expand Up @@ -82,10 +83,10 @@ void load_prog ()
load_file ();

for (int d = 0; d < BLOCK_SIZE /*(int)i_data->i_size*/; d += DIRENT_SIZE) {
if (!strcmp ((char *)(d_dir + 2 + d), "linux")) {
if (!strcmp ((char *)(d_dir + 2 + d), linux+1)) {
i_boot = i_now = (*(int *)(d_dir + d)) - 1;
if (i_boot == -1) continue;
puts ("/linux");
puts (linux);
loadaddr = LOADSEG << 4;
load_file();
continue;
Expand Down Expand Up @@ -121,7 +122,7 @@ static int strcmp (const char * s, const char * d)

static void load_super ()
{
disk_read (2, 2, sb_block, seg_data ());
disk_read (2, 1, sb_block, seg_data ());

/*
if (sb_data->s_log_zone_size) {
Expand Down
34 changes: 17 additions & 17 deletions elks/arch/i86/boot/setup.S
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
! both setup.s and system has been loaded by the bootblock.
!
! This code asks the bios for memory/disk/other parameters, and
! puts them in a "safe" place: INITSEG:0-INITSEG:01FF, ie where the
! boot-block used to be. It is then up to the protected mode
! system to read them from there before the area is overwritten
! for buffer-blocks.
! puts them in a "safe" place: REL_INITSEG:0-REL_INITSEG:01FF, ie where
! the boot-block used to be. It is then up to the kernel to read them
! from there before the area is released to the main memory allocator.
!
! Move PS/2 aux init code to psaux.c
! ([email protected]) 03Oct92
Expand All @@ -36,7 +35,7 @@
!
! index
! ...
! 4: display page
! 4: display page, 1 byte UNUSED
! 6: video mode, 1 byte
! 7: screen_cols, 1 byte
! 8: video data, 2 bytes
Expand Down Expand Up @@ -899,7 +898,6 @@ novga: mov %al,14 // CGA 25 rows

mov $0x0f,%ah
int $0x10
mov %bx,4 // bh = display page
mov %ax,6 // al = video mode, ah = window width

call getcpu // implemented in cputype.S
Expand Down Expand Up @@ -946,7 +944,10 @@ putc: push %ax

#ifdef CONFIG_BOOTOPTS
//
// load /bootopts for FAT filesystem boot
// load /bootopts file for FAT filesystem boot
// If size > 512 bytes, both sectors must be contiguous.
// This is currently guaranteed by providing a 1K /bootopts in
// distribution images, so later edits will remain contiguous.
//
// Uses previous boot sector's BPB contents for disk geometry
// and previous boot sector's buffer which still holds root directory sector.
Expand Down Expand Up @@ -990,20 +991,19 @@ bootopts:
xor %bp,%bp

mov root_dev,%al // Physical Device Address
mov $0xD6,%ah // Read Data
mov $512,%bx
test $0x10,%al // Check Floppy Disk or Hard Disk
mov $0xD6,%ah // Read Data
mov $1024,%bx // 1K bytes
test $0x10,%al // Check Floppy Disk or Hard Disk
jz pc98_int1b
#ifdef CONFIG_IMG_FD1232
mov $1024,%bx
mov $0x03,%ch // 1024 Bytes per sector
inc %dl // sector number for PC_98 Floppy Disk
mov $0x03,%ch // 1024 Bytes per sector
inc %dl // sector number for PC_98 Floppy Disk
#else
mov $0x02,%ch // 512 Bytes per sector
inc %dl // sector number for PC_98 Floppy Disk
mov $0x02,%ch // 512 Bytes per sector
inc %dl // sector number for PC_98 Floppy Disk
#endif
pc98_int1b:
int $0x1B // BIOS disk interrupt
int $0x1B // BIOS disk interrupt
pop %bp
#else
mov $INITSEG,%ax
Expand All @@ -1013,7 +1013,7 @@ pc98_int1b:
mov $DEF_OPTSEG,%ax // ES:BX = DEF_OPTSEG:0
mov %ax,%es
xor %bx,%bx
mov $0x0201,%ax // BIOS read disk, 1 sector
mov $0x0202,%ax // BIOS read disk, 2 sectors
int $0x13 // BIOS disk interrupt
#endif

Expand Down
4 changes: 2 additions & 2 deletions elks/arch/i86/drivers/block/directfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ static void DFPROC redo_fd_request(void)
numsectors = req->rq_nr_sectors;
#ifdef CONFIG_TRACK_CACHE
use_cache = (command == FD_READ) && (req->rq_errors < 4)
&& (SETUP_CPU_TYPE != 7 || running_qemu); /* disable cache on 32-bit systems */
&& (arch_cpu != 7 || running_qemu); /* disable cache on 32-bit systems */
if (use_cache) {
/* full track caching only if cache large enough */
if (CACHE_FULL_TRACK && floppy->sect < CACHE_SIZE)
Expand Down Expand Up @@ -1453,7 +1453,7 @@ static int DFPROC get_fdc_version(void)
}
switch (reply_buffer[0]) {
case 0x80:
if (SETUP_CPU_TYPE > 5) { /* 80286 CPU PC/AT or better */
if (arch_cpu > 5) { /* 80286 CPU PC/AT or better */
type = FDC_TYPE_8272PC_AT;
name = "8272A (PC/AT)";
} else {
Expand Down
3 changes: 2 additions & 1 deletion elks/arch/i86/kernel/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
seg_t membase, memend; /* start and end segment of available main memory */
unsigned int heapsize; /* max size of kernel near heap */
byte_t sys_caps; /* system capabilities bits */
unsigned char arch_cpu; /* CPU type from cputype.S */

unsigned int INITPROC setup_arch(void)
{
Expand Down Expand Up @@ -65,10 +66,10 @@ unsigned int INITPROC setup_arch(void)
}
#endif

arch_cpu = SETUP_CPU_TYPE;
#ifdef SYS_CAPS
sys_caps = SYS_CAPS; /* custom system capabilities */
#else
byte_t arch_cpu = SETUP_CPU_TYPE;
if (arch_cpu > 5) /* 80286+ IBM PC/AT capabilities or Unknown CPU */
sys_caps = CAP_ALL;
debug("arch %d sys_caps %02x\n", arch_cpu, sys_caps);
Expand Down
43 changes: 24 additions & 19 deletions elks/include/linuxmt/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
#define CONFIG_MSDOS_PARTITION 1 /* support DOS HD partitions */
#define CONFIG_FS_DEV 1 /* support FAT /dev folder */

#ifdef CONFIG_ARCH_IBMPC
#define MAX_SERIAL 4 /* max number of serial tty devices*/

/*
* Setup data - normally queried by startup setup.S code, but can
* be overridden for embedded systems with less overhead.
* See setup.S for more details.
* SETUP_ defines are initialzied by setup.S and queried only during kernel init.
* The REL_INITSEG segment is released at end of kernel init. If used later any
* values must be copied, as afterwards setupb/setupw will return incorrect data.
* These defines are overridden for ROM based systems w/o setup code.
* See setup.S for setupb/setupw offsets.
*/

#ifdef CONFIG_ARCH_IBMPC
#define MAX_SERIAL 4 /* max number of serial tty devices*/
#define SETUP_VID_COLS setupb(7) /* BIOS video # columns */
#define SETUP_VID_LINES setupb(14) /* BIOS video # lines */
#define SETUP_CPU_TYPE setupb(0x20) /* processor type */
Expand Down Expand Up @@ -137,30 +139,33 @@
#define DMASEGEND DMASEG /* no DMASEG buffer */
#endif

/* Define segment locations of low memory, must not overlap */

#ifdef CONFIG_ROMCODE
#define DMASEG 0x80 /* start of floppy sector buffer */
#define KERNEL_DATA DMASEGEND /* kernel data segment */
#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 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 */
#else /* !CONFIG_ROMCODE */

#ifdef CONFIG_ARCH_IBMPC
#define OPTSEGSZ 0x400 /* max size of /bootopts file (1024 bytes max) */
#define DEF_OPTSEG 0x50 /* 0x400 bytes boot options at lowest usable ram */
#define REL_INITSEG 0x90 /* 0x200 bytes setup data */
#define DMASEG 0xB0 /* 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 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 */
#ifdef CONFIG_ARCH_PC98
#define OPTSEGSZ 0x400 /* max size of /bootopts file (1024 bytes max) */
#define DEF_OPTSEG 0x60 /* 0x400 bytes boot options at lowest usable ram */
#define REL_INITSEG 0xA0 /* 0x200 bytes setup data */
#define DMASEG 0xC0 /* start of floppy sector buffer */
#define REL_SYSSEG DMASEGEND /* kernel code segment */
#define SETUP_DATA REL_INITSEG
#endif

#endif /* !CONFIG_ROMCODE */

#endif
1 change: 1 addition & 0 deletions elks/include/linuxmt/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define structof(p,t,m) ((t *) ((char *) (p) - offsetof (t,m)))

extern char running_qemu;
extern unsigned char arch_cpu;
extern dev_t dev_console;
extern int debug_level;

Expand Down
Loading

0 comments on commit b8c9588

Please sign in to comment.