summaryrefslogtreecommitdiff
path: root/libinstaller
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-11-05 13:13:25 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-11-05 13:21:04 +0000
commit0b26e59c8f5dc7a8a124a033a78e08c7a2028bcd (patch)
tree9a892c852fabd0a75d10c856105b4488cc87f66c /libinstaller
parentcdeba8ac82f529a3a4a544c4e8346887ef81cb74 (diff)
parentb210bd5bfd0d7182b0a65f507c7557eeb90d5b16 (diff)
downloadsyslinux-0b26e59c8f5dc7a8a124a033a78e08c7a2028bcd.tar.gz
Merge tag 'syslinux-5.00-pre9' into for-hpa/elflink/firmware
This merge also includes the Syslinux-4.06 release. Conflicts: Makefile com32/hdt/Makefile com32/modules/Makefile com32/samples/hello.c mtools/Makefile
Diffstat (limited to 'libinstaller')
-rw-r--r--libinstaller/Makefile5
-rw-r--r--libinstaller/syslinux.h3
-rw-r--r--libinstaller/syslxint.h23
-rw-r--r--libinstaller/syslxmod.c2
4 files changed, 24 insertions, 9 deletions
diff --git a/libinstaller/Makefile b/libinstaller/Makefile
index 30c3d3d6..644ea664 100644
--- a/libinstaller/Makefile
+++ b/libinstaller/Makefile
@@ -1,6 +1,6 @@
# _bin.c files required by both BTARGET and ITARGET installers
BINFILES = bootsect_bin.c ldlinux_bin.c \
- mbr_bin.c gptmbr_bin.c
+ mbr_bin.c gptmbr_bin.c ldlinuxc32_bin.c
PERL = perl
@@ -22,6 +22,9 @@ gptmbr_bin.c: $(OBJ)/../mbr/gptmbr.bin bin2c.pl
installer: $(BINFILES)
+ldlinuxc32_bin.c: ../com32/elflink/ldlinux/ldlinux.c32 bin2c.pl
+ $(PERL) bin2c.pl syslinux_ldlinuxc32 < $< > $@
+
tidy:
rm -f $(BINFILES)
diff --git a/libinstaller/syslinux.h b/libinstaller/syslinux.h
index 8b86f881..f60a066e 100644
--- a/libinstaller/syslinux.h
+++ b/libinstaller/syslinux.h
@@ -26,6 +26,9 @@ extern unsigned char syslinux_ldlinux[];
extern const unsigned int syslinux_ldlinux_len;
extern const int syslinux_ldlinux_mtime;
+extern unsigned char syslinux_ldlinuxc32[];
+extern const unsigned int syslinux_ldlinuxc32_len;
+
#define boot_sector syslinux_bootsect
#define boot_sector_len syslinux_bootsect_len
#define boot_image syslinux_ldlinux
diff --git a/libinstaller/syslxint.h b/libinstaller/syslxint.h
index 2e317d0e..e5428b79 100644
--- a/libinstaller/syslxint.h
+++ b/libinstaller/syslxint.h
@@ -23,6 +23,17 @@
# define X86_MEM 0
#endif
+#ifdef __GNUC__
+# ifdef __MINGW32__
+ /* gcc 4.7 miscompiles packed structures in MS-bitfield mode */
+# define PACKED __attribute__((packed,gcc_struct))
+# else
+# define PACKED __attribute__((packed))
+# endif
+#else
+# error "Need to define PACKED for this compiler"
+#endif
+
/*
* Access functions for littleendian numbers, possibly misaligned.
*/
@@ -190,7 +201,7 @@ struct ext_patch_area {
struct syslinux_extent {
uint64_t lba;
uint16_t len;
-} __attribute__((packed));
+} PACKED;
/* FAT bootsector format, also used by other disk-based derivatives */
struct fat_boot_sector {
@@ -218,7 +229,7 @@ struct fat_boot_sector {
char VolumeLabel[11];
char FileSysType[8];
uint8_t Code[442];
- } __attribute__ ((packed)) bs16;
+ } PACKED bs16;
struct {
uint32_t FATSz32;
uint16_t ExtFlags;
@@ -234,13 +245,13 @@ struct fat_boot_sector {
char VolumeLabel[11];
char FileSysType[8];
uint8_t Code[414];
- } __attribute__ ((packed)) bs32;
- } __attribute__ ((packed));
+ } PACKED bs32;
+ } PACKED;
uint32_t bsMagic;
uint16_t bsForwardPtr;
uint16_t bsSignature;
-} __attribute__ ((packed));
+} PACKED;
/* NTFS bootsector format */
struct ntfs_boot_sector {
@@ -273,7 +284,7 @@ struct ntfs_boot_sector {
uint32_t bsMagic;
uint16_t bsForwardPtr;
uint16_t bsSignature;
-} __attribute__((packed));
+} PACKED;
#define FAT_bsHead bsJump
#define FAT_bsHeadLen offsetof(struct fat_boot_sector, bsBytesPerSec)
diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c
index 5ec156ac..98e2710a 100644
--- a/libinstaller/syslxmod.c
+++ b/libinstaller/syslxmod.c
@@ -96,8 +96,6 @@ static inline void *ptr(void *img, uint16_t *offset_p)
* Returns the number of modified bytes in ldlinux.sys if successful,
* otherwise -1.
*/
-#define NADV 2
-
int syslinux_patch(const sector_t *sectp, int nsectors,
int stupid, int raid_mode,
const char *subdir, const char *subvol)