[syslinux:master] mtools: create an empty ADV

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Tue Jun 22 17:12:21 PDT 2010


Commit-ID:  134e5f60f81f3372407a771898c381afe394abbf
Gitweb:     http://syslinux.zytor.com/commit/134e5f60f81f3372407a771898c381afe394abbf
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Tue, 22 Jun 2010 17:09:52 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Tue, 22 Jun 2010 17:09:52 -0700

mtools: create an empty ADV

Create an install an empty ADV.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>


---
 mtools/Makefile   |    1 +
 mtools/syslinux.c |   13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/mtools/Makefile b/mtools/Makefile
index 5f08b2d..70bed14 100644
--- a/mtools/Makefile
+++ b/mtools/Makefile
@@ -9,6 +9,7 @@ LDFLAGS	 = -s
 SRCS     = syslinux.c \
 	   ../libinstaller/fat.c \
 	   ../libinstaller/syslxmod.c \
+	   ../libinstaller/setadv.c \
 	   ../libinstaller/bootsect_bin.c \
 	   ../libinstaller/ldlinux_bin.c \
 	   $(wildcard ../libfat/*.c)
diff --git a/mtools/syslinux.c b/mtools/syslinux.c
index 0f4ccf9..ade8440 100644
--- a/mtools/syslinux.c
+++ b/mtools/syslinux.c
@@ -37,6 +37,7 @@
 
 #include "syslinux.h"
 #include "libfat.h"
+#include "setadv.h"
 
 char *program;			/* Name of program */
 char *device;			/* Device to install to */
@@ -239,12 +240,20 @@ int main(int argc, char *argv[])
 	exit(1);
     }
 
+    /*
+     * Create a vacuous ADV in memory.  This should be smarter.
+     */
+    syslinux_reset_adv(syslinux_adv);
+
     /* This command may fail legitimately */
     system("mattrib -h -r -s s:/ldlinux.sys 2>/dev/null");
 
     mtp = popen("mcopy -D o -D O -o - s:/ldlinux.sys", "w");
-    if (!mtp || (fwrite(syslinux_ldlinux, 1, syslinux_ldlinux_len, mtp)
-		 != syslinux_ldlinux_len) ||
+    if (!mtp ||
+	fwrite(syslinux_ldlinux, 1, syslinux_ldlinux_len, mtp)
+		!= syslinux_ldlinux_len ||
+	fwrite(syslinux_adv, 1, 2 * ADV_SIZE, mtp)
+		!= 2 * ADV_SIZE ||
 	(status = pclose(mtp), !WIFEXITED(status) || WEXITSTATUS(status))) {
 	die("failed to create ldlinux.sys");
     }



More information about the Syslinux-commits mailing list