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

[build] Update build.c kernel builder with better messages #1990

Merged
merged 2 commits into from
Sep 3, 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
7 changes: 3 additions & 4 deletions elks/arch/i86/boot/setup.S
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ debug_loader = 0 // display relocations
#define KERNEL_MAGICNUMBER MINIX_SPLITID_LOW

#ifndef CONFIG_ROMCODE
INITSEG = DEF_INITSEG // initial setup data seg, we move boot here - out of the way
SYSSEG = DEF_SYSSEG // first kernel blob load point before relocation
INITSEG = DEF_INITSEG // initial setup data seg and initial Image load address
SYSSEG = DEF_SYSSEG // first kernel blob copy load point before relocation
SETUPSEG = DEF_SETUPSEG // this is the current code segment
#else
INITSEG = CONFIG_ROM_SETUP_DATA
Expand Down Expand Up @@ -245,8 +245,7 @@ done_move_kernel:
cld
mov $INITSEG,%ax
mov %ax,%ss
//mov $0x4000-12,%sp
mov $0x1000,%sp // 2K stack: 0x0800 setup size + 0x0800 stack
mov $0x1000,%sp // 4k gives 7 setup sectors and 512 byte stack above
.hex4sp %ss,"\nNew INIT SS:"
.hex4sp %sp,"SP:"

Expand Down
28 changes: 14 additions & 14 deletions elks/arch/i86/tools/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#define MINIX_HEADER 0x20
#define SUPL_HEADER 0x40

#define SYS_SIZE DEF_SYSSIZE

#define DEFAULT_MAJOR_ROOT 0x03 /* BIOS floppy 0 */
#define DEFAULT_MINOR_ROOT 0x80

Expand Down Expand Up @@ -161,7 +159,7 @@ int main(int argc, char **argv)
/* for compatibility with LILO */
if (setup_sectors < SETUP_SECTS)
setup_sectors = SETUP_SECTS;
fprintf(stderr, "Setup is %d bytes.\n", i);
fprintf(stderr, "Setup is %d bytes (%d sectors).\n", i, setup_sectors);
for (c = 0; c < sizeof(buf); c++)
buf[c] = '\0';
while (i < setup_sectors * 512) {
Expand Down Expand Up @@ -204,18 +202,20 @@ int main(int argc, char **argv)
lseek(id, 0, 0);

sys_size = (sz + 15) / 16;
fprintf(stderr, "System is %d (%xh paras)\n", sz, sys_size);
if (sys_size > SYS_SIZE)
fprintf(stderr, "System is %d B (0x%x paras)\n", sz, sys_size);
if (sys_size > DEF_SYSMAX)
die("System is too big");
#if 0 && !defined(CONFIG_ROMCODE) /* no longer correct */
/* compute boot load address to avoid overwriting image at boot relocation time*/
fsz = (ex->a_hdrlen + (intel_long(ex->a_text) + intel_long(ex->a_data)) + 15) / 16
+ REL_SYSSEG;
fprintf(stderr, "Text/Data load ending segment is %x, limit %x\n", fsz, DEF_SYSSEG);
if (fsz > DEF_SYSSEG + REL_SYSSEG) { /* start of reloc entry table at boot */
fprintf(stderr, "System too large for DEF_SYSSEG at %x, increase DEF_SYSSEG\n",
DEF_SYSSEG);
exit(1);
#ifndef CONFIG_ROMCODE
/* display start and end setup.S copy address for informational purposes */
fsz = (ex->a_hdrlen + (intel_long(ex->a_text) + intel_long(ex->a_data)) + 15) / 16;
if (ex->a_hdrlen == SUPL_HEADER) {
fsz += (intel_long(ex->a_trsize) + intel_long(ex->a_drsize)
+ intel_long(ex->esh_ftrsize) + intel_long(ex->esh_ftseg) + 15) / 16;
}
fsz += REL_SYSSEG;
fprintf(stderr, "Load segment start 0x%x end 0x%x\n", DEF_SYSSEG, fsz);
if (DEF_SYSSEG < REL_SYSSEG + 0x1000) {
fprintf(stderr, "Warning: Load segment too low for REL_SYSSEG at %x, increase DEF_SYSSEG\n", REL_SYSSEG);
}
#endif
while (sz > 0) {
Expand Down
4 changes: 2 additions & 2 deletions elks/include/linuxmt/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@

/* Don't touch these, unless you really know what you are doing. */
#define DEF_INITSEG 0x0100 /* initial Image load address by boot code */
#define DEF_SYSSEG 0x1300 /* kernel copied here by setup.S code */
#define DEF_SYSSEG 0x1300 /* address setup then copies kernel to, then REL_SYSSEG */
#define DEF_SETUPSEG DEF_INITSEG + 0x20
#define DEF_SYSSIZE 0x2F00
#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).
Expand Down
Loading