MODULES = chain.c32 config.c32 ethersel.c32 dmitest.c32 cpuidtest.c32 \
disk.c32 pcitest.c32 elf.c32 linux.c32 reboot.c32 pmload.c32 \
meminfo.c32 sdi.c32 sanboot.c32 ifcpu64.c32 vesainfo.c32 \
- kbdmap.c32 cmd.c32 vpdtest.c32 host.c32 dir.c32 gpxecmd.c32
- kbdmap.c32 cmd.c32 vpdtest.c32 gpxecmd.c32 ifcpu.c32
++ kbdmap.c32 cmd.c32 vpdtest.c32 host.c32 dir.c32 gpxecmd.c32 \
++ ifcpu.c32
TESTFILES =
topdir = ..
include $(topdir)/MCONFIG.embedded
-LDFLAGS = -T com16.ld
+CFLAGS += -D__MSDOS__
+ # CFLAGS += -DDEBUG
+
+LDFLAGS = -T dosexe.ld
OPTFLAGS = -g
INCLUDES = -include code16.h -nostdinc -iwithprefix include \
-I. -I.. -I../libfat -I ../libinstaller
../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
$(wildcard ../libfat/*.c)
-OBJS = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
+OBJS = header.o crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
- LIBOBJS = conio.o memcpy.o memset.o skipatou.o atou.o malloc.o free.o \
+ LIBOBJS = int2526.o conio.o memcpy.o memset.o skipatou.o atou.o \
+ malloc.o free.o \
argv.o printf.o __divdi3.o __udivmoddi4.o
VPATH = .:../libfat:../libinstaller
ldlinux_name[0] = dev_fd | 0x40;
- set_attributes(ldlinux_name, 0x00);
- fd = creat(ldlinux_name, 0);
- write_file(fd, syslinux_ldlinux, syslinux_ldlinux_len);
+ set_attributes(ldlinux_name, 0);
- fd = creat(ldlinux_name, 0x07); /* SYSTEM HIDDEN READONLY */
++ fd = creat(ldlinux_name, 0); /* SYSTEM HIDDEN READONLY */
+ write_ldlinux(fd);
close(fd);
+ set_attributes(ldlinux_name, 0x07); /* SYSTEM HIDDEN READONLY */
/*
* Now, use libfat to create a block map. This probably
/*
* Patch ldlinux.sys and the boot sector
*/
- syslinux_patch(sectors, nsectors, stupid, raid_mode);
+ i = syslinux_patch(sectors, nsectors, stupid, raid_mode);
+ patch_sectors = (i + SECTOR_SIZE - 1) >> SECTOR_SHIFT;
/*
- * Write the now-patched first sector of ldlinux.sys
+ * Overwrite the now-patched ldlinux.sys
*/
- lock_device(3);
+ /* lock_device(3); -- doesn't seem to be needed */
- write_device(dev_fd, syslinux_ldlinux, 1, sectors[0]);
+ for (i = 0; i < patch_sectors; i++) {
+ uint16_t si, di, cx;
+ si = 0;
+ di = (size_t) sectbuf;
+ cx = SECTOR_SIZE >> 2;
+ asm volatile ("movw %3,%%fs ; fs ; rep ; movsl":"+S" (si), "+D"(di),
+ "+c"(cx)
+ :"abd"((uint16_t)
+ (ldlinux_seg + (i << (SECTOR_SHIFT - 4)))));
+ write_device(dev_fd, sectbuf, 1, sectors[i]);
+ }
/*
* Muck with the MBR, if desired, while we hold the lock