aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2010-10-09 07:41:12 -0400
committerGene Cumm <gene.cumm@gmail.com>2010-10-09 07:41:12 -0400
commitf8a2515b7c25495dc61460d70b8bcf811b0dec20 (patch)
tree95de321dcb0a2ddc39906210cafea27478653d35
parent1d3b53de86e8477b5a47a20bd1e502daa7f23f19 (diff)
parentf2330884f94b131481042a5742711f518eac84cf (diff)
downloadsyslinux-f8a2515b7c25495dc61460d70b8bcf811b0dec20.tar.gz
syslinux-f8a2515b7c25495dc61460d70b8bcf811b0dec20.tar.xz
syslinux-f8a2515b7c25495dc61460d70b8bcf811b0dec20.zip
Merge branch 'master' into rosh_for_hpa
-rw-r--r--com32/modules/chain.c32
-rw-r--r--core/diskstart.inc15
-rw-r--r--core/fs/diskio.c2
-rw-r--r--core/fs/iso9660/iso9660.c2
-rw-r--r--core/fs/lib/mangle.c2
-rw-r--r--core/fs/pxe/pxe.c14
-rw-r--r--core/keywords1
-rw-r--r--core/keywords.inc1
-rw-r--r--core/mem/free.c2
-rw-r--r--core/parseconfig.inc2
-rwxr-xr-xextlinux/main.c43
-rw-r--r--libinstaller/syslxopt.c30
-rw-r--r--version2
13 files changed, 118 insertions, 30 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 48a83d2a..6a5b1151 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -133,6 +133,7 @@ static struct options {
bool swap;
bool hide;
bool sethidden;
+ bool drmk;
} opt;
struct data_area {
@@ -624,8 +625,8 @@ static struct disk_part_iter *next_mbr_part(struct disk_part_iter *part)
/* Update parameters to reflect this new partition. Re-use iterator */
part->lba_data = table[part->private.mbr_index].start_lba;
- dprintf("Partition %d primary lba %u\n", part->index, part->lba_data);
- part->index++;
+ dprintf("Partition %d primary lba %u\n", part->private.mbr_index, part->lba_data);
+ part->index = part->private.mbr_index + 1;
part->record = table + part->private.mbr_index;
return part;
@@ -869,7 +870,7 @@ static struct disk_part_iter *next_gpt_part(struct disk_part_iter *part)
part->private.gpt.part_guid = &gpt_part->uid;
part->private.gpt.part_label = gpt_part->name;
/* Update our index */
- part->index++;
+ part->index = part->private.gpt.index + 1;
gpt_part_dump(gpt_part);
/* In a GPT scheme, we re-use the iterator */
@@ -1281,6 +1282,7 @@ Options: file=<loader> Load and execute file, instead of boot sector\n\
freedos=<loader> Load FreeDOS KERNEL.SYS\n\
msdos=<loader> Load MS-DOS IO.SYS\n\
pcdos=<loader> Load PC-DOS IBMBIO.COM\n\
+ drmk=<loader> Load DRMK DELLBIO.BIN\n\
grub=<loader> Load GRUB Legacy stage2\n\
grubcfg=<filename> Set alternative config filename for GRUB Legacy\n\
grldr=<loader> Load GRUB4DOS grldr\n\
@@ -1351,6 +1353,11 @@ int main(int argc, char *argv[])
opt.seg = 0x70; /* MS-DOS 2.0+ wants this address */
opt.loadfile = argv[i] + 6;
opt.sethidden = true;
+ } else if (!strncmp(argv[i], "drmk=", 5)) {
+ opt.seg = 0x70; /* DRMK wants this address */
+ opt.loadfile = argv[i] + 5;
+ opt.sethidden = true;
+ opt.drmk = true;
} else if (!strncmp(argv[i], "grub=", 5)) {
opt.seg = 0x800; /* stage2 wants this address */
opt.loadfile = argv[i] + 5;
@@ -1697,6 +1704,25 @@ int main(int argc, char *argv[])
}
}
+ if (opt.drmk) {
+ /* DRMK entry is different than MS-DOS/PC-DOS */
+ /*
+ * A new size, aligned to 16 bytes to ease use of ds:[bp+28].
+ * We only really need 4 new, usable bytes at the end.
+ */
+ int tsize = (data[ndata].size + 19) & 0xfffffff0;
+ regs.ss = regs.fs = regs.gs = 0; /* Used before initialized */
+ if (!realloc(data[ndata].data, tsize)) {
+ error("Failed to realloc for DRMK\n");
+ goto bail;
+ }
+ data[ndata].size = tsize;
+ /* ds:[bp+28] must be 0x0000003f */
+ regs.ds = (tsize >> 4) + (opt.seg - 2);
+ /* "Patch" into tail of the new space */
+ *(int *)(data[ndata].data + tsize - 4) = 0x0000003f;
+ }
+
ndata++;
}
diff --git a/core/diskstart.inc b/core/diskstart.inc
index c0ba52a0..c0301d4b 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -31,9 +31,10 @@ PartInfo equ StackBuf
.gpt equ PartInfo+20
FloppyTable equ PartInfo+76
; Total size of PartInfo + FloppyTable == 76+16 = 92 bytes
-Hidden equ StackBuf-20 ; Partition offset
-OrigFDCTabPtr equ StackBuf-12 ; The 2nd high dword on the stack
-OrigESDI equ StackBuf-8 ; The high dword on the stack
+Hidden equ StackBuf-24 ; Partition offset (qword)
+OrigFDCTabPtr equ StackBuf-16 ; Original FDC table
+OrigDSSI equ StackBuf-12 ; DS:SI -> partinfo
+OrigESDI equ StackBuf-8 ; ES:DI -> $PnP structure
DriveNumber equ StackBuf-4 ; Drive number
StackHome equ Hidden ; The start of the canonical stack
@@ -116,6 +117,8 @@ start:
push dx ; Save drive number (in DL)
push es ; Save initial ES:DI -> $PnP pointer
push di
+ push ds ; Save original DS:SI -> partinfo
+ push si
mov es,cx
;
@@ -174,6 +177,12 @@ floppy:
; Note: di points to beyond the end of PartInfo
;
harddisk:
+ mov dx,[di-76-10] ; Original DS
+ mov si,[di-76-12] ; Original SI
+ shr si,4
+ add dx,si
+ cmp dx,PartInfo >> 4
+ jae .no_partition
test byte [di-76],7Fh ; Sanity check: "active flag" should
jnz .no_partition ; be 00 or 80
cmp [di-76+4],cl ; Sanity check: partition type != 0
diff --git a/core/fs/diskio.c b/core/fs/diskio.c
index 481b59b0..38d3da35 100644
--- a/core/fs/diskio.c
+++ b/core/fs/diskio.c
@@ -163,8 +163,6 @@ static int edd_rdwr_sectors(struct disk *disk, void *buf,
memset(&reset, 0, sizeof reset);
- ireg.edx.b[0] = disk->disk_number;
-
lba += disk->part_start;
while (count) {
chunk = count;
diff --git a/core/fs/iso9660/iso9660.c b/core/fs/iso9660/iso9660.c
index 62137d0d..46f5f175 100644
--- a/core/fs/iso9660/iso9660.c
+++ b/core/fs/iso9660/iso9660.c
@@ -63,6 +63,8 @@ static void iso_mangle_name(char *dst, const char *src)
if ( (*(dst-1) != '.') && (*(dst-1) != '/') )
break;
+ if ((dst[-1] == '/') && ((dst - 1) == p))
+ break;
dst --;
i ++;
diff --git a/core/fs/lib/mangle.c b/core/fs/lib/mangle.c
index 813099fb..8c2077a9 100644
--- a/core/fs/lib/mangle.c
+++ b/core/fs/lib/mangle.c
@@ -36,6 +36,8 @@ void generic_mangle_name(char *dst, const char *src)
break;
if (dst[-1] != '/')
break;
+ if ((dst[-1] == '/') && ((dst - 1) == p))
+ break;
dst--;
i++;
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index 0238ed4b..a1e40974 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -642,8 +642,22 @@ static uint32_t pxe_getfssec(struct file *file, char *buf,
* @out: the lenght of this file, stores in file->file_len
*
*/
+static void __pxe_searchdir(const char *filename, struct file *file);
+extern uint16_t PXERetry;
+
static void pxe_searchdir(const char *filename, struct file *file)
{
+ int i = PXERetry;
+
+ do {
+ dprintf("PXE: file = %p, retries left = %d: ", file, i);
+ __pxe_searchdir(filename, file);
+ dprintf("%s\n", file->inode ? "ok" : "failed");
+ } while (!file->inode && i--);
+}
+
+static void __pxe_searchdir(const char *filename, struct file *file)
+{
struct fs_info *fs = file->fs;
struct inode *inode;
struct pxe_pvt_inode *socket;
diff --git a/core/keywords b/core/keywords
index c289ae29..7f585b48 100644
--- a/core/keywords
+++ b/core/keywords
@@ -16,6 +16,7 @@ linux
boot
bss
pxe
+pxeretry
fdimage
comboot
com32
diff --git a/core/keywords.inc b/core/keywords.inc
index d0f7db36..7f1404e9 100644
--- a/core/keywords.inc
+++ b/core/keywords.inc
@@ -78,6 +78,7 @@ keywd_table:
keyword noescape, pc_setint16, NoEscape
keyword nocomplete, pc_setint16, NoComplete
keyword nohalt, pc_setint16, NoHalt
+ keyword pxeretry, pc_setint16, PXERetry
keyword f1, pc_filename, FKeyN(1)
keyword f2, pc_filename, FKeyN(2)
keyword f3, pc_filename, FKeyN(3)
diff --git a/core/mem/free.c b/core/mem/free.c
index 0becb9e8..384f10ea 100644
--- a/core/mem/free.c
+++ b/core/mem/free.c
@@ -136,7 +136,7 @@ static void __free_tagged(malloc_tag_t tag) {
for (i = 0; i < NHEAP; i++) {
dprintf("__free_tagged(%u) heap %d\n", tag, i);
head = &__malloc_head[i];
- for (fp = head ; fp != head ; fp = fp->a.next) {
+ for (fp = head->a.next ; fp != head ; fp = fp->a.next) {
if (ARENA_TYPE_GET(fp->a.attrs) == ARENA_TYPE_USED &&
fp->a.tag == tag)
fp = __free_block(fp);
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index e7b3108b..69681d94 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -462,6 +462,8 @@ AllowImplicit dw 1 ; Allow implicit kernels
AllowOptions dw 1 ; User-specified options allowed
IncludeLevel dw 1 ; Nesting level
DefaultLevel dw 0 ; The current level of default
+ global PXERetry
+PXERetry dw 0 ; Extra PXE retries
VKernel db 0 ; Have we seen any "label" statements?
%if IS_PXELINUX
diff --git a/extlinux/main.c b/extlinux/main.c
index 002cecd9..30422c2d 100755
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -100,6 +100,32 @@ struct geometry_table {
struct hd_geometry g;
};
+static int sysfs_get_offset(int devfd, unsigned long *start)
+{
+ struct stat st;
+ char sysfs_name[128];
+ FILE *f;
+ int rv;
+
+ if (fstat(devfd, &st))
+ return -1;
+
+ if ((size_t)snprintf(sysfs_name, sizeof sysfs_name,
+ "/sys/dev/block/%u:%u/start",
+ major(st.st_dev), minor(st.st_dev))
+ >= sizeof sysfs_name)
+ return -1;
+
+ f = fopen(sysfs_name, "r");
+ if (!f)
+ return -1;
+
+ rv = fscanf(f, "%lu", start);
+ fclose(f);
+
+ return (rv == 1) ? 0 : -1;
+}
+
/* Standard floppy disk geometries, plus LS-120. Zipdisk geometry
(x/64/32) is the final fallback. I don't know what LS-240 has
as its geometry, since I don't have one and don't know anyone that does,
@@ -123,24 +149,25 @@ int get_geometry(int devfd, uint64_t totalbytes, struct hd_geometry *geo)
struct loop_info li;
struct loop_info64 li64;
const struct geometry_table *gp;
+ int rv = 0;
memset(geo, 0, sizeof *geo);
if (!ioctl(devfd, HDIO_GETGEO, &geo)) {
- return 0;
+ goto ok;
} else if (!ioctl(devfd, FDGETPRM, &fd_str)) {
geo->heads = fd_str.head;
geo->sectors = fd_str.sect;
geo->cylinders = fd_str.track;
geo->start = 0;
- return 0;
+ goto ok;
}
/* Didn't work. Let's see if this is one of the standard geometries */
for (gp = standard_geometries; gp->bytes; gp++) {
if (gp->bytes == totalbytes) {
memcpy(geo, &gp->g, sizeof *geo);
- return 0;
+ goto ok;
}
}
@@ -153,19 +180,25 @@ int get_geometry(int devfd, uint64_t totalbytes, struct hd_geometry *geo)
geo->cylinders = totalbytes / (geo->heads * geo->sectors << SECTOR_SHIFT);
geo->start = 0;
- if (!opt.sectors && !opt.heads)
+ if (!opt.sectors && !opt.heads) {
fprintf(stderr,
"Warning: unable to obtain device geometry (defaulting to %d heads, %d sectors)\n"
" (on hard disks, this is usually harmless.)\n",
geo->heads, geo->sectors);
+ rv = 1; /* Suboptimal result */
+ }
+ok:
/* If this is a loopback device, try to set the start */
if (!ioctl(devfd, LOOP_GET_STATUS64, &li64))
geo->start = li64.lo_offset >> SECTOR_SHIFT;
else if (!ioctl(devfd, LOOP_GET_STATUS, &li))
geo->start = (unsigned int)li.lo_offset >> SECTOR_SHIFT;
+ else if (!sysfs_get_offset(devfd, &geo->start)) {
+ /* OK */
+ }
- return 1;
+ return rv;
}
/*
diff --git a/libinstaller/syslxopt.c b/libinstaller/syslxopt.c
index 18a6baac..7ceb3ba2 100644
--- a/libinstaller/syslxopt.c
+++ b/libinstaller/syslxopt.c
@@ -68,7 +68,7 @@ const struct option long_options[] = {
{0, 0, 0, 0}
};
-const char short_options[] = "t:fid:UuzS:H:rvho:OM:ma";
+const char short_options[] = "t:fid:UuzsS:H:rvho:OM:ma";
void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
{
@@ -101,7 +101,7 @@ void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
fprintf(stderr,
" --install -i Install over the current bootsector\n"
- " --update -U Update a previous EXTLINUX installation\n"
+ " --update -U Update a previous installation\n"
" --zip -z Force zipdrive geometry (-H 64 -S 32)\n"
" --sectors=# -S Force the number of sectors per track\n"
" --heads=# -H Force number of heads\n"
@@ -111,20 +111,20 @@ void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
" --clear-once -O Clear the boot-once command\n"
" --reset-adv Reset auxilliary data\n",
mode == MODE_SYSLINUX ? " " : "-o");
- /* Have to chop this roughly in half for the DOS installer for some reason */
+ /*
+ * Have to chop this roughly in half for the DOS installer due
+ * to limited output buffer size
+ */
fprintf(stderr,
- " --menu-save= -M Set the label to select as default on the next boot\n"
- " --mbr -m Install an MBR (DOS/Win32 installers only)\n"
- " --active -a Mark partition as active (DOS/Win32 installers only)\n"
- " --force -f Ignore precautions (DOS/Win32/mtools installers only)\n"
- "\n"
- " Note: geometry is determined at boot time for devices which\n"
- " are considered hard disks by the BIOS. Unfortunately, this is\n"
- " not possible for devices which are considered floppy disks,\n"
- " which includes zipdisks and LS-120 superfloppies.\n"
- "\n"
- " The -z option is useful for USB devices which are considered\n"
- " hard disks by some BIOSes and zipdrives by other BIOSes.");
+ " --menu-save= -M Set the label to select as default on the next boot\n");
+ if (mode == MODE_SYSLINUX_DOSWIN)
+ fprintf(stderr,
+ " --mbr -m Install an MBR\n"
+ " --active -a Mark partition as active\n");
+
+ if (mode == MODE_SYSLINUX_DOSWIN || mode == MODE_SYSLINUX)
+ fprintf(stderr,
+ " --force -f Ignore precautions\n");
exit(rv);
}
diff --git a/version b/version
index 0e60f145..1152a5aa 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-4.02 2010
+4.03 2010