summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2013-05-09 13:24:02 +1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-16 00:09:46 +0300
commitbadd71825352f4a2aaf40707154f4d5f506a45f6 (patch)
treeef2ca1fa4baa6a72fc3bacdbd4e0290562712fc6 /meta
parentfb89bb369be0863d7c1175fcf10c4860e547fd9c (diff)
downloadpoky-badd71825352f4a2aaf40707154f4d5f506a45f6.tar.gz
syslinux: Update to 4.06
Patches are now part of upstream or no longer needed. Added new util-linux dependency for isohybrid. Paths updated to reflect directory structure changes. Add CFLAGS and LDFLAGS overrides. [YOCTO #4438] (From OE-Core rev: 17e7ac0c5e75245d17a90e5cc49ade3d18a168ba) Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/boot-directdisk.bbclass4
-rw-r--r--meta/classes/syslinux.bbclass8
-rw-r--r--meta/recipes-devtools/syslinux/files/cross-build.patch71
-rw-r--r--meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch975
-rw-r--r--meta/recipes-devtools/syslinux/files/no-strip.patch31
-rw-r--r--meta/recipes-devtools/syslinux/syslinux_4.06.bb (renamed from meta/recipes-devtools/syslinux/syslinux_4.03.bb)33
6 files changed, 21 insertions, 1101 deletions
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 2a8823da20..a3c9a876c1 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -48,7 +48,7 @@ build_boot_dd() {
48 install -d ${HDDDIR} 48 install -d ${HDDDIR}
49 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage ${HDDDIR}/vmlinuz 49 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage ${HDDDIR}/vmlinuz
50 install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg 50 install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg
51 install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys 51 install -m 444 ${STAGING_DATADIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
52 52
53 BLOCKS=`du -bks ${HDDDIR} | cut -f 1` 53 BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
54 BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}` 54 BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}`
@@ -82,7 +82,7 @@ build_boot_dd() {
82 parted $IMAGE print 82 parted $IMAGE print
83 83
84 OFFSET=`expr $END2 / 512` 84 OFFSET=`expr $END2 / 512`
85 dd if=${STAGING_LIBDIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc 85 dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc
86 dd if=${HDDIMG} of=$IMAGE conv=notrunc seek=1 bs=512 86 dd if=${HDDIMG} of=$IMAGE conv=notrunc seek=1 bs=512
87 dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 87 dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512
88 88
diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index 0b90eab228..501bc6db8e 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -40,9 +40,9 @@ syslinux_populate() {
40 40
41syslinux_iso_populate() { 41syslinux_iso_populate() {
42 syslinux_populate ${ISODIR} ${ISOLINUXDIR} isolinux.cfg 42 syslinux_populate ${ISODIR} ${ISOLINUXDIR} isolinux.cfg
43 install -m 0644 ${STAGING_LIBDIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR} 43 install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR}
44 if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then 44 if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then
45 install -m 0644 ${STAGING_LIBDIR}/syslinux/vesamenu.c32 ${ISODIR}${ISOLINUXDIR}/vesamenu.c32 45 install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${ISODIR}${ISOLINUXDIR}/vesamenu.c32
46 if [ "${SYSLINUX_SPLASH}" != "" ] ; then 46 if [ "${SYSLINUX_SPLASH}" != "" ] ; then
47 install -m 0644 ${SYSLINUX_SPLASH} ${ISODIR}${ISOLINUXDIR}/splash.lss 47 install -m 0644 ${SYSLINUX_SPLASH} ${ISODIR}${ISOLINUXDIR}/splash.lss
48 fi 48 fi
@@ -51,9 +51,9 @@ syslinux_iso_populate() {
51 51
52syslinux_hddimg_populate() { 52syslinux_hddimg_populate() {
53 syslinux_populate ${HDDDIR} ${SYSLINUXDIR} syslinux.cfg 53 syslinux_populate ${HDDDIR} ${SYSLINUXDIR} syslinux.cfg
54 install -m 0444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}${SYSLINUXDIR}/ldlinux.sys 54 install -m 0444 ${STAGING_DATADIR}/syslinux/ldlinux.sys ${HDDDIR}${SYSLINUXDIR}/ldlinux.sys
55 if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then 55 if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then
56 install -m 0644 ${STAGING_LIBDIR}/syslinux/vesamenu.c32 ${HDDDIR}${SYSLINUXDIR}/vesamenu.c32 56 install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${HDDDIR}${SYSLINUXDIR}/vesamenu.c32
57 if [ "${SYSLINUX_SPLASH}" != "" ] ; then 57 if [ "${SYSLINUX_SPLASH}" != "" ] ; then
58 install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss 58 install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss
59 fi 59 fi
diff --git a/meta/recipes-devtools/syslinux/files/cross-build.patch b/meta/recipes-devtools/syslinux/files/cross-build.patch
deleted file mode 100644
index 7bb6bdae18..0000000000
--- a/meta/recipes-devtools/syslinux/files/cross-build.patch
+++ /dev/null
@@ -1,71 +0,0 @@
1Upstream-Status: Inappropriate [configuration]
2
3Use ?= for Makefile variables to use poky environment variables.
4Original method to sed s/CC =/CC ?=/ is not applicable anymore
5because of the Makefile changes.
6
7against 3.86
8
906/28/2010 - qhe
10
11also AUXDIR stays in $(LIBDIR)/syslinux rather than $(DATADIR)/syslinux
12
1307/08/2010 - qhe
14
15updated for 4.03
16
1711/16/2010 - Qing He <qing.he@intel.com>
18
19---
20diff --git a/MCONFIG b/MCONFIG
21index e9c16d3..4d49f33 100644
22--- a/MCONFIG
23+++ b/MCONFIG
24@@ -18,13 +18,13 @@
25 MAKEFLAGS += -r
26 MAKE += -r
27
28-BINDIR = /usr/bin
29-SBINDIR = /sbin
30-LIBDIR = /usr/lib
31-DATADIR = /usr/share
32-AUXDIR = $(DATADIR)/syslinux
33-MANDIR = /usr/man
34-INCDIR = /usr/include
35+BINDIR ?= /usr/bin
36+SBINDIR ?= /sbin
37+LIBDIR ?= /usr/lib
38+DATADIR ?= /usr/share
39+AUXDIR = $(LIBDIR)/syslinux
40+MANDIR ?= /usr/man
41+INCDIR ?= /usr/include
42 TFTPBOOT = /tftpboot
43 COM32DIR = $(AUXDIR)/com32
44
45@@ -38,18 +38,18 @@ PERL = perl
46
47 CHMOD = chmod
48
49-CC = gcc
50+CC ?= gcc
51 gcc_ok = $(shell tmpf=gcc_ok.$$$$.tmp; \
52 if $(CC) $(GCCOPT) $(1) -c $(topdir)/dummy.c \
53 -o $$tmpf 2>/dev/null ; \
54 then echo '$(1)'; else echo '$(2)'; fi; \
55 rm -f $$tmpf)
56
57-LD = ld
58-OBJDUMP = objdump
59-OBJCOPY = objcopy
60-AR = ar
61-NM = nm
62-RANLIB = ranlib
63+LD ?= ld
64+OBJDUMP ?= objdump
65+OBJCOPY ?= objcopy
66+AR ?= ar
67+NM ?= nm
68+RANLIB ?= ranlib
69 GZIPPROG = gzip
70 PNGTOPNM = pngtopnm
71 MCOPY = mcopy
diff --git a/meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch b/meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch
deleted file mode 100644
index 77d7a5d3a5..0000000000
--- a/meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch
+++ /dev/null
@@ -1,975 +0,0 @@
1From a1006762fa6f98750bb77d76dd992cb8ea9f9c99 Mon Sep 17 00:00:00 2001
2Message-Id: <a1006762fa6f98750bb77d76dd992cb8ea9f9c99.1333550572.git.dvhart@linux.intel.com>
3From: "H. Peter Anvin" <hpa@zytor.com>
4Date: Mon, 26 Mar 2012 22:51:09 -0700
5Subject: [PATCH] libinstaller: Avoid using <linux/ext2_fs.h>
6
7Don't use <linux/ext2_fs.h> if we can avoid it.
8
9Upstream-Status: Available in syslinux-4.06-pre3
10
11The ioctl constants have been globalized and moved to <linux/fs.h>.
12Use a private copy of ext2_fs.h from e2fsprogs with the ioctl
13constants removed for the data structures.
14
15Do at least attempt backward compatibility for old kernel headers, but
16no real hope of proper operation there...
17
18Signed-off-by: H. Peter Anvin <hpa@zytor.com>
19
20Massaged into 4.03.
21
22Integrated-by: Darren Hart <dvhart@linux.inte.com>
23---
24 libinstaller/ext2fs/ext2_fs.h | 856 +++++++++++++++++++++++++++++++++++++++++
25 libinstaller/linuxioctl.h | 29 ++-
26 libinstaller/syslxcom.c | 12 +-
27 3 files changed, 886 insertions(+), 11 deletions(-)
28 create mode 100644 libinstaller/ext2fs/ext2_fs.h
29
30Index: syslinux-4.03/libinstaller/ext2fs/ext2_fs.h
31===================================================================
32--- /dev/null
33+++ syslinux-4.03/libinstaller/ext2fs/ext2_fs.h
34@@ -0,0 +1,856 @@
35+/*
36+ * linux/include/linux/ext2_fs.h
37+ *
38+ * Copyright (C) 1992, 1993, 1994, 1995
39+ * Remy Card (card@masi.ibp.fr)
40+ * Laboratoire MASI - Institut Blaise Pascal
41+ * Universite Pierre et Marie Curie (Paris VI)
42+ *
43+ * from
44+ *
45+ * linux/include/linux/minix_fs.h
46+ *
47+ * Copyright (C) 1991, 1992 Linus Torvalds
48+ */
49+
50+#ifndef _EXT2FS_EXT2_FS_H
51+#define _EXT2FS_EXT2_FS_H
52+
53+#include <linux/types.h>
54+
55+/*
56+ * The second extended filesystem constants/structures
57+ */
58+
59+/*
60+ * Define EXT2FS_DEBUG to produce debug messages
61+ */
62+#undef EXT2FS_DEBUG
63+
64+/*
65+ * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
66+ */
67+#define EXT2_PREALLOCATE
68+#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
69+
70+/*
71+ * The second extended file system version
72+ */
73+#define EXT2FS_DATE "95/08/09"
74+#define EXT2FS_VERSION "0.5b"
75+
76+/*
77+ * Special inode numbers
78+ */
79+#define EXT2_BAD_INO 1 /* Bad blocks inode */
80+#define EXT2_ROOT_INO 2 /* Root inode */
81+#define EXT4_USR_QUOTA_INO 3 /* User quota inode */
82+#define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */
83+#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
84+#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
85+#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */
86+#define EXT2_JOURNAL_INO 8 /* Journal inode */
87+#define EXT2_EXCLUDE_INO 9 /* The "exclude" inode, for snapshots */
88+#define EXT4_REPLICA_INO 10 /* Used by non-upstream feature */
89+
90+/* First non-reserved inode for old ext2 filesystems */
91+#define EXT2_GOOD_OLD_FIRST_INO 11
92+
93+/*
94+ * The second extended file system magic number
95+ */
96+#define EXT2_SUPER_MAGIC 0xEF53
97+
98+#ifdef __KERNEL__
99+#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
100+#else
101+/* Assume that user mode programs are passing in an ext2fs superblock, not
102+ * a kernel struct super_block. This will allow us to call the feature-test
103+ * macros from user land. */
104+#define EXT2_SB(sb) (sb)
105+#endif
106+
107+/*
108+ * Maximal count of links to a file
109+ */
110+#define EXT2_LINK_MAX 65000
111+
112+/*
113+ * Macro-instructions used to manage several block sizes
114+ */
115+#define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */
116+#define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */
117+#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE)
118+#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE)
119+#ifdef __KERNEL__
120+#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
121+#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
122+#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits)
123+#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
124+#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
125+#else
126+#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
127+#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
128+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
129+ EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
130+#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
131+ EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino)
132+#endif
133+#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32))
134+
135+/*
136+ * Macro-instructions used to manage allocation clusters
137+ */
138+#define EXT2_MIN_CLUSTER_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
139+#define EXT2_MAX_CLUSTER_LOG_SIZE 29 /* 512MB */
140+#define EXT2_MIN_CLUSTER_SIZE EXT2_MIN_BLOCK_SIZE
141+#define EXT2_MAX_CLUSTER_SIZE (1 << EXT2_MAX_CLUSTER_LOG_SIZE)
142+#define EXT2_CLUSTER_SIZE(s) (EXT2_MIN_BLOCK_SIZE << \
143+ (s)->s_log_cluster_size)
144+#define EXT2_CLUSTER_SIZE_BITS(s) ((s)->s_log_cluster_size + 10)
145+
146+/*
147+ * Macro-instructions used to manage fragments
148+ *
149+ * Note: for backwards compatibility only, for the dump program.
150+ * Ext2/3/4 will never support fragments....
151+ */
152+#define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE
153+#define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE
154+#define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
155+#define EXT2_FRAG_SIZE(s) EXT2_BLOCK_SIZE(s)
156+#define EXT2_FRAGS_PER_BLOCK(s) 1
157+
158+/*
159+ * ACL structures
160+ */
161+struct ext2_acl_header /* Header of Access Control Lists */
162+{
163+ __u32 aclh_size;
164+ __u32 aclh_file_count;
165+ __u32 aclh_acle_count;
166+ __u32 aclh_first_acle;
167+};
168+
169+struct ext2_acl_entry /* Access Control List Entry */
170+{
171+ __u32 acle_size;
172+ __u16 acle_perms; /* Access permissions */
173+ __u16 acle_type; /* Type of entry */
174+ __u16 acle_tag; /* User or group identity */
175+ __u16 acle_pad1;
176+ __u32 acle_next; /* Pointer on next entry for the */
177+ /* same inode or on next free entry */
178+};
179+
180+/*
181+ * Structure of a blocks group descriptor
182+ */
183+struct ext2_group_desc
184+{
185+ __u32 bg_block_bitmap; /* Blocks bitmap block */
186+ __u32 bg_inode_bitmap; /* Inodes bitmap block */
187+ __u32 bg_inode_table; /* Inodes table block */
188+ __u16 bg_free_blocks_count; /* Free blocks count */
189+ __u16 bg_free_inodes_count; /* Free inodes count */
190+ __u16 bg_used_dirs_count; /* Directories count */
191+ __u16 bg_flags;
192+ __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
193+ __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
194+ __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
195+ __u16 bg_itable_unused; /* Unused inodes count */
196+ __u16 bg_checksum; /* crc16(s_uuid+grouo_num+group_desc)*/
197+};
198+
199+/*
200+ * Structure of a blocks group descriptor
201+ */
202+struct ext4_group_desc
203+{
204+ __u32 bg_block_bitmap; /* Blocks bitmap block */
205+ __u32 bg_inode_bitmap; /* Inodes bitmap block */
206+ __u32 bg_inode_table; /* Inodes table block */
207+ __u16 bg_free_blocks_count; /* Free blocks count */
208+ __u16 bg_free_inodes_count; /* Free inodes count */
209+ __u16 bg_used_dirs_count; /* Directories count */
210+ __u16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
211+ __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
212+ __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
213+ __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
214+ __u16 bg_itable_unused; /* Unused inodes count */
215+ __u16 bg_checksum; /* crc16(sb_uuid+group+desc) */
216+ __u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
217+ __u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
218+ __u32 bg_inode_table_hi; /* Inodes table block MSB */
219+ __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */
220+ __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */
221+ __u16 bg_used_dirs_count_hi; /* Directories count MSB */
222+ __u16 bg_itable_unused_hi; /* Unused inodes count MSB */
223+ __u32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */
224+ __u16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
225+ __u16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
226+ __u32 bg_reserved;
227+};
228+
229+#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */
230+#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */
231+#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
232+
233+/*
234+ * Data structures used by the directory indexing feature
235+ *
236+ * Note: all of the multibyte integer fields are little endian.
237+ */
238+
239+/*
240+ * Note: dx_root_info is laid out so that if it should somehow get
241+ * overlaid by a dirent the two low bits of the hash version will be
242+ * zero. Therefore, the hash version mod 4 should never be 0.
243+ * Sincerely, the paranoia department.
244+ */
245+struct ext2_dx_root_info {
246+ __u32 reserved_zero;
247+ __u8 hash_version; /* 0 now, 1 at release */
248+ __u8 info_length; /* 8 */
249+ __u8 indirect_levels;
250+ __u8 unused_flags;
251+};
252+
253+#define EXT2_HASH_LEGACY 0
254+#define EXT2_HASH_HALF_MD4 1
255+#define EXT2_HASH_TEA 2
256+#define EXT2_HASH_LEGACY_UNSIGNED 3 /* reserved for userspace lib */
257+#define EXT2_HASH_HALF_MD4_UNSIGNED 4 /* reserved for userspace lib */
258+#define EXT2_HASH_TEA_UNSIGNED 5 /* reserved for userspace lib */
259+
260+#define EXT2_HASH_FLAG_INCOMPAT 0x1
261+
262+struct ext2_dx_entry {
263+ __u32 hash;
264+ __u32 block;
265+};
266+
267+struct ext2_dx_countlimit {
268+ __u16 limit;
269+ __u16 count;
270+};
271+
272+
273+/*
274+ * Macro-instructions used to manage group descriptors
275+ */
276+#define EXT2_MIN_DESC_SIZE 32
277+#define EXT2_MIN_DESC_SIZE_64BIT 64
278+#define EXT2_MAX_DESC_SIZE EXT2_MIN_BLOCK_SIZE
279+#define EXT2_DESC_SIZE(s) \
280+ ((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \
281+ (s)->s_desc_size : EXT2_MIN_DESC_SIZE)
282+
283+#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
284+#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
285+#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group)
286+#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
287+/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
288+#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \
289+ (EXT2_CLUSTER_SIZE(s) / \
290+ EXT2_BLOCK_SIZE(s)))
291+#define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8)
292+#define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \
293+ EXT2_INODES_PER_BLOCK(s))
294+#ifdef __KERNEL__
295+#define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
296+#define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
297+#else
298+#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
299+#endif
300+
301+/*
302+ * Constants relative to the data blocks
303+ */
304+#define EXT2_NDIR_BLOCKS 12
305+#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
306+#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
307+#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
308+#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
309+
310+/*
311+ * Inode flags
312+ */
313+#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */
314+#define EXT2_UNRM_FL 0x00000002 /* Undelete */
315+#define EXT2_COMPR_FL 0x00000004 /* Compress file */
316+#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */
317+#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
318+#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
319+#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
320+#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
321+/* Reserved for compression usage... */
322+#define EXT2_DIRTY_FL 0x00000100
323+#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
324+#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */
325+#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
326+/* End compression flags --- maybe not all used */
327+#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
328+#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */
329+#define EXT2_IMAGIC_FL 0x00002000
330+#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
331+#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
332+#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
333+#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
334+#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
335+#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
336+#define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
337+/* EXT4_EOFBLOCKS_FL 0x00400000 was here */
338+#define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
339+#define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
340+#define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
341+#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
342+
343+#define EXT2_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */
344+#define EXT2_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */
345+
346+/*
347+ * ioctl commands
348+ */
349+
350+/* Used for online resize */
351+struct ext2_new_group_input {
352+ __u32 group; /* Group number for this data */
353+ __u32 block_bitmap; /* Absolute block number of block bitmap */
354+ __u32 inode_bitmap; /* Absolute block number of inode bitmap */
355+ __u32 inode_table; /* Absolute block number of inode table start */
356+ __u32 blocks_count; /* Total number of blocks in this group */
357+ __u16 reserved_blocks; /* Number of reserved blocks in this group */
358+ __u16 unused; /* Number of reserved GDT blocks in group */
359+};
360+
361+struct ext4_new_group_input {
362+ __u32 group; /* Group number for this data */
363+ __u64 block_bitmap; /* Absolute block number of block bitmap */
364+ __u64 inode_bitmap; /* Absolute block number of inode bitmap */
365+ __u64 inode_table; /* Absolute block number of inode table start */
366+ __u32 blocks_count; /* Total number of blocks in this group */
367+ __u16 reserved_blocks; /* Number of reserved blocks in this group */
368+ __u16 unused;
369+};
370+
371+#ifdef __GNU__ /* Needed for the Hurd */
372+#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0)
373+#endif
374+
375+#define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
376+#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
377+#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
378+#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
379+#define EXT2_IOC_GETVERSION_NEW _IOR('f', 3, long)
380+#define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long)
381+#define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
382+#define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input)
383+#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
384+#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
385+
386+/*
387+ * Structure of an inode on the disk
388+ */
389+struct ext2_inode {
390+ __u16 i_mode; /* File mode */
391+ __u16 i_uid; /* Low 16 bits of Owner Uid */
392+ __u32 i_size; /* Size in bytes */
393+ __u32 i_atime; /* Access time */
394+ __u32 i_ctime; /* Inode change time */
395+ __u32 i_mtime; /* Modification time */
396+ __u32 i_dtime; /* Deletion Time */
397+ __u16 i_gid; /* Low 16 bits of Group Id */
398+ __u16 i_links_count; /* Links count */
399+ __u32 i_blocks; /* Blocks count */
400+ __u32 i_flags; /* File flags */
401+ union {
402+ struct {
403+ __u32 l_i_version; /* was l_i_reserved1 */
404+ } linux1;
405+ struct {
406+ __u32 h_i_translator;
407+ } hurd1;
408+ } osd1; /* OS dependent 1 */
409+ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
410+ __u32 i_generation; /* File version (for NFS) */
411+ __u32 i_file_acl; /* File ACL */
412+ __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */
413+ __u32 i_faddr; /* Fragment address */
414+ union {
415+ struct {
416+ __u16 l_i_blocks_hi;
417+ __u16 l_i_file_acl_high;
418+ __u16 l_i_uid_high; /* these 2 fields */
419+ __u16 l_i_gid_high; /* were reserved2[0] */
420+ __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
421+ __u16 l_i_reserved;
422+ } linux2;
423+ struct {
424+ __u8 h_i_frag; /* Fragment number */
425+ __u8 h_i_fsize; /* Fragment size */
426+ __u16 h_i_mode_high;
427+ __u16 h_i_uid_high;
428+ __u16 h_i_gid_high;
429+ __u32 h_i_author;
430+ } hurd2;
431+ } osd2; /* OS dependent 2 */
432+};
433+
434+/*
435+ * Permanent part of an large inode on the disk
436+ */
437+struct ext2_inode_large {
438+ __u16 i_mode; /* File mode */
439+ __u16 i_uid; /* Low 16 bits of Owner Uid */
440+ __u32 i_size; /* Size in bytes */
441+ __u32 i_atime; /* Access time */
442+ __u32 i_ctime; /* Inode Change time */
443+ __u32 i_mtime; /* Modification time */
444+ __u32 i_dtime; /* Deletion Time */
445+ __u16 i_gid; /* Low 16 bits of Group Id */
446+ __u16 i_links_count; /* Links count */
447+ __u32 i_blocks; /* Blocks count */
448+ __u32 i_flags; /* File flags */
449+ union {
450+ struct {
451+ __u32 l_i_version; /* was l_i_reserved1 */
452+ } linux1;
453+ struct {
454+ __u32 h_i_translator;
455+ } hurd1;
456+ } osd1; /* OS dependent 1 */
457+ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
458+ __u32 i_generation; /* File version (for NFS) */
459+ __u32 i_file_acl; /* File ACL */
460+ __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */
461+ __u32 i_faddr; /* Fragment address */
462+ union {
463+ struct {
464+ __u16 l_i_blocks_hi;
465+ __u16 l_i_file_acl_high;
466+ __u16 l_i_uid_high; /* these 2 fields */
467+ __u16 l_i_gid_high; /* were reserved2[0] */
468+ __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
469+ __u16 l_i_reserved;
470+ } linux2;
471+ struct {
472+ __u8 h_i_frag; /* Fragment number */
473+ __u8 h_i_fsize; /* Fragment size */
474+ __u16 h_i_mode_high;
475+ __u16 h_i_uid_high;
476+ __u16 h_i_gid_high;
477+ __u32 h_i_author;
478+ } hurd2;
479+ } osd2; /* OS dependent 2 */
480+ __u16 i_extra_isize;
481+ __u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */
482+ __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
483+ __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */
484+ __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
485+ __u32 i_crtime; /* File creation time */
486+ __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/
487+ __u32 i_version_hi; /* high 32 bits for 64-bit version */
488+};
489+
490+#define i_dir_acl i_size_high
491+
492+#if defined(__KERNEL__) || defined(__linux__)
493+#define i_reserved1 osd1.linux1.l_i_reserved1
494+#define i_frag osd2.linux2.l_i_frag
495+#define i_fsize osd2.linux2.l_i_fsize
496+#define i_uid_low i_uid
497+#define i_gid_low i_gid
498+#define i_uid_high osd2.linux2.l_i_uid_high
499+#define i_gid_high osd2.linux2.l_i_gid_high
500+#else
501+#if defined(__GNU__)
502+
503+#define i_translator osd1.hurd1.h_i_translator
504+#define i_frag osd2.hurd2.h_i_frag;
505+#define i_fsize osd2.hurd2.h_i_fsize;
506+#define i_uid_high osd2.hurd2.h_i_uid_high
507+#define i_gid_high osd2.hurd2.h_i_gid_high
508+#define i_author osd2.hurd2.h_i_author
509+
510+#endif /* __GNU__ */
511+#endif /* defined(__KERNEL__) || defined(__linux__) */
512+
513+#define inode_uid(inode) ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16)
514+#define inode_gid(inode) ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16)
515+#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x))
516+#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x))
517+
518+/*
519+ * File system states
520+ */
521+#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
522+#define EXT2_ERROR_FS 0x0002 /* Errors detected */
523+#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
524+
525+/*
526+ * Misc. filesystem flags
527+ */
528+#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
529+#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
530+#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* OK for use on development code */
531+#define EXT2_FLAGS_IS_SNAPSHOT 0x0010 /* This is a snapshot image */
532+#define EXT2_FLAGS_FIX_SNAPSHOT 0x0020 /* Snapshot inodes corrupted */
533+#define EXT2_FLAGS_FIX_EXCLUDE 0x0040 /* Exclude bitmaps corrupted */
534+
535+/*
536+ * Mount flags
537+ */
538+#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */
539+#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */
540+#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */
541+#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
542+#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
543+#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
544+#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
545+#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */
546+
547+#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
548+#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
549+#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
550+ EXT2_MOUNT_##opt)
551+/*
552+ * Maximal mount counts between two filesystem checks
553+ */
554+#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
555+#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
556+
557+/*
558+ * Behaviour when detecting errors
559+ */
560+#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
561+#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
562+#define EXT2_ERRORS_PANIC 3 /* Panic */
563+#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
564+
565+#if (__GNUC__ >= 4)
566+#define ext4_offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER)
567+#else
568+#define ext4_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
569+#endif
570+
571+/*
572+ * Structure of the super block
573+ */
574+struct ext2_super_block {
575+ __u32 s_inodes_count; /* Inodes count */
576+ __u32 s_blocks_count; /* Blocks count */
577+ __u32 s_r_blocks_count; /* Reserved blocks count */
578+ __u32 s_free_blocks_count; /* Free blocks count */
579+ __u32 s_free_inodes_count; /* Free inodes count */
580+ __u32 s_first_data_block; /* First Data Block */
581+ __u32 s_log_block_size; /* Block size */
582+ __u32 s_log_cluster_size; /* Allocation cluster size */
583+ __u32 s_blocks_per_group; /* # Blocks per group */
584+ __u32 s_clusters_per_group; /* # Fragments per group */
585+ __u32 s_inodes_per_group; /* # Inodes per group */
586+ __u32 s_mtime; /* Mount time */
587+ __u32 s_wtime; /* Write time */
588+ __u16 s_mnt_count; /* Mount count */
589+ __s16 s_max_mnt_count; /* Maximal mount count */
590+ __u16 s_magic; /* Magic signature */
591+ __u16 s_state; /* File system state */
592+ __u16 s_errors; /* Behaviour when detecting errors */
593+ __u16 s_minor_rev_level; /* minor revision level */
594+ __u32 s_lastcheck; /* time of last check */
595+ __u32 s_checkinterval; /* max. time between checks */
596+ __u32 s_creator_os; /* OS */
597+ __u32 s_rev_level; /* Revision level */
598+ __u16 s_def_resuid; /* Default uid for reserved blocks */
599+ __u16 s_def_resgid; /* Default gid for reserved blocks */
600+ /*
601+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
602+ *
603+ * Note: the difference between the compatible feature set and
604+ * the incompatible feature set is that if there is a bit set
605+ * in the incompatible feature set that the kernel doesn't
606+ * know about, it should refuse to mount the filesystem.
607+ *
608+ * e2fsck's requirements are more strict; if it doesn't know
609+ * about a feature in either the compatible or incompatible
610+ * feature set, it must abort and not try to meddle with
611+ * things it doesn't understand...
612+ */
613+ __u32 s_first_ino; /* First non-reserved inode */
614+ __u16 s_inode_size; /* size of inode structure */
615+ __u16 s_block_group_nr; /* block group # of this superblock */
616+ __u32 s_feature_compat; /* compatible feature set */
617+ __u32 s_feature_incompat; /* incompatible feature set */
618+ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
619+ __u8 s_uuid[16]; /* 128-bit uuid for volume */
620+ char s_volume_name[16]; /* volume name */
621+ char s_last_mounted[64]; /* directory where last mounted */
622+ __u32 s_algorithm_usage_bitmap; /* For compression */
623+ /*
624+ * Performance hints. Directory preallocation should only
625+ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
626+ */
627+ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
628+ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
629+ __u16 s_reserved_gdt_blocks; /* Per group table for online growth */
630+ /*
631+ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
632+ */
633+ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
634+ __u32 s_journal_inum; /* inode number of journal file */
635+ __u32 s_journal_dev; /* device number of journal file */
636+ __u32 s_last_orphan; /* start of list of inodes to delete */
637+ __u32 s_hash_seed[4]; /* HTREE hash seed */
638+ __u8 s_def_hash_version; /* Default hash version to use */
639+ __u8 s_jnl_backup_type; /* Default type of journal backup */
640+ __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */
641+ __u32 s_default_mount_opts;
642+ __u32 s_first_meta_bg; /* First metablock group */
643+ __u32 s_mkfs_time; /* When the filesystem was created */
644+ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
645+ __u32 s_blocks_count_hi; /* Blocks count high 32bits */
646+ __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/
647+ __u32 s_free_blocks_hi; /* Free blocks count */
648+ __u16 s_min_extra_isize; /* All inodes have at least # bytes */
649+ __u16 s_want_extra_isize; /* New inodes should reserve # bytes */
650+ __u32 s_flags; /* Miscellaneous flags */
651+ __u16 s_raid_stride; /* RAID stride */
652+ __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */
653+ __u64 s_mmp_block; /* Block for multi-mount protection */
654+ __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
655+ __u8 s_log_groups_per_flex; /* FLEX_BG group size */
656+ __u8 s_reserved_char_pad;
657+ __u16 s_reserved_pad; /* Padding to next 32bits */
658+ __u64 s_kbytes_written; /* nr of lifetime kilobytes written */
659+ __u32 s_snapshot_inum; /* Inode number of active snapshot */
660+ __u32 s_snapshot_id; /* sequential ID of active snapshot */
661+ __u64 s_snapshot_r_blocks_count; /* reserved blocks for active
662+ snapshot's future use */
663+ __u32 s_snapshot_list; /* inode number of the head of the on-disk snapshot list */
664+#define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count)
665+ __u32 s_error_count; /* number of fs errors */
666+ __u32 s_first_error_time; /* first time an error happened */
667+ __u32 s_first_error_ino; /* inode involved in first error */
668+ __u64 s_first_error_block; /* block involved of first error */
669+ __u8 s_first_error_func[32]; /* function where the error happened */
670+ __u32 s_first_error_line; /* line number where error happened */
671+ __u32 s_last_error_time; /* most recent time of an error */
672+ __u32 s_last_error_ino; /* inode involved in last error */
673+ __u32 s_last_error_line; /* line number where error happened */
674+ __u64 s_last_error_block; /* block involved of last error */
675+ __u8 s_last_error_func[32]; /* function where the error happened */
676+#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts)
677+ __u8 s_mount_opts[64];
678+ __u32 s_usr_quota_inum; /* inode number of user quota file */
679+ __u32 s_grp_quota_inum; /* inode number of group quota file */
680+ __u32 s_overhead_blocks; /* overhead blocks/clusters in fs */
681+ __u32 s_reserved[108]; /* Padding to the end of the block */
682+ __u32 s_checksum; /* crc32c(superblock) */
683+};
684+
685+#define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
686+
687+/*
688+ * Codes for operating systems
689+ */
690+#define EXT2_OS_LINUX 0
691+#define EXT2_OS_HURD 1
692+#define EXT2_OBSO_OS_MASIX 2
693+#define EXT2_OS_FREEBSD 3
694+#define EXT2_OS_LITES 4
695+
696+/*
697+ * Revision levels
698+ */
699+#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
700+#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
701+
702+#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
703+#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
704+
705+#define EXT2_GOOD_OLD_INODE_SIZE 128
706+
707+/*
708+ * Journal inode backup types
709+ */
710+#define EXT3_JNL_BACKUP_BLOCKS 1
711+
712+/*
713+ * Feature set definitions
714+ */
715+
716+#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
717+ ( EXT2_SB(sb)->s_feature_compat & (mask) )
718+#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
719+ ( EXT2_SB(sb)->s_feature_ro_compat & (mask) )
720+#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
721+ ( EXT2_SB(sb)->s_feature_incompat & (mask) )
722+
723+#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
724+#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
725+#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
726+#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
727+#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010
728+#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
729+#define EXT2_FEATURE_COMPAT_LAZY_BG 0x0040
730+/* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE 0x0080 not used, legacy */
731+#define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP 0x0100
732+
733+
734+#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
735+#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
736+/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */
737+#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
738+#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
739+#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
740+#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
741+#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT 0x0080
742+#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100
743+#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200
744+#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400
745+#define EXT4_FEATURE_RO_COMPAT_REPLICA 0x0800
746+
747+#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
748+#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
749+#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
750+#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
751+#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
752+#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040
753+#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
754+#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
755+#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
756+#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400
757+#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000
758+
759+#define EXT2_FEATURE_COMPAT_SUPP 0
760+#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
761+ EXT4_FEATURE_INCOMPAT_MMP)
762+#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
763+ EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
764+ EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
765+ EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
766+
767+/*
768+ * Default values for user and/or group using reserved blocks
769+ */
770+#define EXT2_DEF_RESUID 0
771+#define EXT2_DEF_RESGID 0
772+
773+/*
774+ * Default mount options
775+ */
776+#define EXT2_DEFM_DEBUG 0x0001
777+#define EXT2_DEFM_BSDGROUPS 0x0002
778+#define EXT2_DEFM_XATTR_USER 0x0004
779+#define EXT2_DEFM_ACL 0x0008
780+#define EXT2_DEFM_UID16 0x0010
781+#define EXT3_DEFM_JMODE 0x0060
782+#define EXT3_DEFM_JMODE_DATA 0x0020
783+#define EXT3_DEFM_JMODE_ORDERED 0x0040
784+#define EXT3_DEFM_JMODE_WBACK 0x0060
785+#define EXT4_DEFM_NOBARRIER 0x0100
786+#define EXT4_DEFM_BLOCK_VALIDITY 0x0200
787+#define EXT4_DEFM_DISCARD 0x0400
788+#define EXT4_DEFM_NODELALLOC 0x0800
789+
790+/*
791+ * Structure of a directory entry
792+ */
793+#define EXT2_NAME_LEN 255
794+
795+struct ext2_dir_entry {
796+ __u32 inode; /* Inode number */
797+ __u16 rec_len; /* Directory entry length */
798+ __u16 name_len; /* Name length */
799+ char name[EXT2_NAME_LEN]; /* File name */
800+};
801+
802+/*
803+ * The new version of the directory entry. Since EXT2 structures are
804+ * stored in intel byte order, and the name_len field could never be
805+ * bigger than 255 chars, it's safe to reclaim the extra byte for the
806+ * file_type field.
807+ */
808+struct ext2_dir_entry_2 {
809+ __u32 inode; /* Inode number */
810+ __u16 rec_len; /* Directory entry length */
811+ __u8 name_len; /* Name length */
812+ __u8 file_type;
813+ char name[EXT2_NAME_LEN]; /* File name */
814+};
815+
816+/*
817+ * Ext2 directory file types. Only the low 3 bits are used. The
818+ * other bits are reserved for now.
819+ */
820+#define EXT2_FT_UNKNOWN 0
821+#define EXT2_FT_REG_FILE 1
822+#define EXT2_FT_DIR 2
823+#define EXT2_FT_CHRDEV 3
824+#define EXT2_FT_BLKDEV 4
825+#define EXT2_FT_FIFO 5
826+#define EXT2_FT_SOCK 6
827+#define EXT2_FT_SYMLINK 7
828+
829+#define EXT2_FT_MAX 8
830+
831+/*
832+ * EXT2_DIR_PAD defines the directory entries boundaries
833+ *
834+ * NOTE: It must be a multiple of 4
835+ */
836+#define EXT2_DIR_PAD 4
837+#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
838+#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
839+ ~EXT2_DIR_ROUND)
840+
841+/*
842+ * This structure is used for multiple mount protection. It is written
843+ * into the block number saved in the s_mmp_block field in the superblock.
844+ * Programs that check MMP should assume that if SEQ_FSCK (or any unknown
845+ * code above SEQ_MAX) is present then it is NOT safe to use the filesystem,
846+ * regardless of how old the timestamp is.
847+ *
848+ * The timestamp in the MMP structure will be updated by e2fsck at some
849+ * arbitary intervals (start of passes, after every few groups of inodes
850+ * in pass1 and pass1b). There is no guarantee that e2fsck is updating
851+ * the MMP block in a timely manner, and the updates it does are purely
852+ * for the convenience of the sysadmin and not for automatic validation.
853+ *
854+ * Note: Only the mmp_seq value is used to determine whether the MMP block
855+ * is being updated. The mmp_time, mmp_nodename, and mmp_bdevname
856+ * fields are only for informational purposes for the administrator,
857+ * due to clock skew between nodes and hostname HA service takeover.
858+ */
859+#define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */
860+#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
861+#define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */
862+#define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */
863+
864+struct mmp_struct {
865+ __u32 mmp_magic; /* Magic number for MMP */
866+ __u32 mmp_seq; /* Sequence no. updated periodically */
867+ __u64 mmp_time; /* Time last updated */
868+ char mmp_nodename[64]; /* Node which last updated MMP block */
869+ char mmp_bdevname[32]; /* Bdev which last updated MMP block */
870+ __u16 mmp_check_interval; /* Changed mmp_check_interval */
871+ __u16 mmp_pad1;
872+ __u32 mmp_pad2[227];
873+};
874+
875+/*
876+ * Default interval for MMP update in seconds.
877+ */
878+#define EXT4_MMP_UPDATE_INTERVAL 5
879+
880+/*
881+ * Maximum interval for MMP update in seconds.
882+ */
883+#define EXT4_MMP_MAX_UPDATE_INTERVAL 300
884+
885+/*
886+ * Minimum interval for MMP checking in seconds.
887+ */
888+#define EXT4_MMP_MIN_CHECK_INTERVAL 5
889+
890+#endif /* _EXT2FS_EXT2_FS_H */
891Index: syslinux-4.03/libinstaller/linuxioctl.h
892===================================================================
893--- syslinux-4.03.orig/libinstaller/linuxioctl.h
894+++ syslinux-4.03/libinstaller/linuxioctl.h
895@@ -9,17 +9,33 @@
896
897 #include <sys/ioctl.h>
898
899+#ifdef __linux__
900+
901 #define statfs _kernel_statfs /* HACK to deal with broken 2.4 distros */
902
903 #include <linux/fd.h> /* Floppy geometry */
904 #include <linux/hdreg.h> /* Hard disk geometry */
905
906-#include <linux/fs.h> /* FIGETBSZ, FIBMAP, FS_IOC_FIEMAP */
907+#include <linux/fs.h> /* FIGETBSZ, FIBMAP, FS_IOC_* */
908 #include <linux/msdos_fs.h> /* FAT_IOCTL_SET_ATTRIBUTES */
909
910 #undef SECTOR_SIZE /* Defined in msdos_fs.h for no good reason */
911 #undef SECTOR_BITS
912-#include <linux/ext2_fs.h> /* EXT2_IOC_* */
913+
914+#ifndef FS_IOC_GETFLAGS
915+/* Old kernel headers, these were once ext2-specific... */
916+# include <linux/ext2_fs.h> /* EXT2_IOC_* */
917+
918+# define FS_IOC_GETFLAGS EXT2_IOC_GETFLAGS
919+# define FS_IOC_SETFLAGS EXT2_IOC_SETFLAGS
920+
921+# define FS_IMMUTABLE_FL EXT2_IMMUTABLE_FL
922+
923+#else
924+
925+# include <ext2fs/ext2_fs.h>
926+
927+#endif
928
929 #ifndef FAT_IOCTL_GET_ATTRIBUTES
930 # define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
931@@ -37,11 +53,13 @@
932
933 #undef statfs
934
935-#if defined(__linux__) && !defined(BLKGETSIZE64)
936+#ifndef BLKGETSIZE64
937 /* This takes a u64, but the size field says size_t. Someone screwed big. */
938 # define BLKGETSIZE64 _IOR(0x12,114,size_t)
939 #endif
940
941 #include <linux/loop.h>
942
943+#endif /* __linux__ */
944+
945 #endif /* LIBINSTALLER_LINUXIOCTL_H */
946Index: syslinux-4.03/libinstaller/syslxcom.c
947===================================================================
948--- syslinux-4.03.orig/libinstaller/syslxcom.c
949+++ syslinux-4.03/libinstaller/syslxcom.c
950@@ -121,9 +121,9 @@ void clear_attributes(int fd)
951 {
952 int flags;
953
954- if (!ioctl(fd, EXT2_IOC_GETFLAGS, &flags)) {
955- flags &= ~EXT2_IMMUTABLE_FL;
956- ioctl(fd, EXT2_IOC_SETFLAGS, &flags);
957+ if (!ioctl(fd, FS_IOC_GETFLAGS, &flags)) {
958+ flags &= ~FS_IMMUTABLE_FL;
959+ ioctl(fd, FS_IOC_SETFLAGS, &flags);
960 }
961 break;
962 }
963@@ -151,9 +151,9 @@ void set_attributes(int fd)
964 {
965 int flags;
966
967- if (st.st_uid == 0 && !ioctl(fd, EXT2_IOC_GETFLAGS, &flags)) {
968- flags |= EXT2_IMMUTABLE_FL;
969- ioctl(fd, EXT2_IOC_SETFLAGS, &flags);
970+ if (st.st_uid == 0 && !ioctl(fd, FS_IOC_GETFLAGS, &flags)) {
971+ flags |= FS_IMMUTABLE_FL;
972+ ioctl(fd, FS_IOC_SETFLAGS, &flags);
973 }
974 break;
975 }
diff --git a/meta/recipes-devtools/syslinux/files/no-strip.patch b/meta/recipes-devtools/syslinux/files/no-strip.patch
deleted file mode 100644
index 775851a75d..0000000000
--- a/meta/recipes-devtools/syslinux/files/no-strip.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1Disable stripping of binaries
2
3We don't want to strip these as this is handled separately at package
4time.
5
6Upstream-Status: Inappropriate [configuration]
7
8Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
9
10--- syslinux-4.03.orig/mtools/Makefile
11+++ syslinux-4.03/mtools/Makefile
12@@ -4,7 +4,7 @@ include $(topdir)/MCONFIG
13 OPTFLAGS = -g -Os
14 INCLUDES = -I. -I.. -I../libfat -I../libinstaller
15 CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
16-LDFLAGS = -s
17+LDFLAGS =
18
19 SRCS = syslinux.c \
20 ../libinstaller/fat.c \
21--- syslinux-4.03.orig/utils/Makefile
22+++ syslinux-4.03/utils/Makefile
23@@ -18,7 +18,7 @@ topdir = ..
24 include $(topdir)/MCONFIG
25
26 CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
27-LDFLAGS = -O2 -s
28+LDFLAGS = -O2
29
30 TARGETS = mkdiskimage isohybrid gethostip memdiskfind
31 TARGETS += isohybrid.pl # about to be obsoleted
diff --git a/meta/recipes-devtools/syslinux/syslinux_4.03.bb b/meta/recipes-devtools/syslinux/syslinux_4.06.bb
index 7c3ecda305..c2e69f6e78 100644
--- a/meta/recipes-devtools/syslinux/syslinux_4.03.bb
+++ b/meta/recipes-devtools/syslinux/syslinux_4.06.bb
@@ -2,20 +2,17 @@ DESCRIPTION = "A multi-purpose linux bootloader"
2HOMEPAGE = "http://syslinux.zytor.com/" 2HOMEPAGE = "http://syslinux.zytor.com/"
3LICENSE = "GPLv2+" 3LICENSE = "GPLv2+"
4LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \ 4LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
5 file://README;beginline=28;endline=34;md5=a4607efd4a6392017186d08099e7d546" 5 file://README;beginline=35;endline=41;md5=f7249a750bc692d1048b2626752aa415"
6 6
7# If you really want to run syslinux, you need mtools. We just want the 7# If you really want to run syslinux, you need mtools. We just want the
8# ldlinux.* stuff for now, so skip mtools-native 8# ldlinux.* stuff for now, so skip mtools-native
9DEPENDS = "nasm-native" 9DEPENDS = "nasm-native util-linux"
10PR = "r9" 10PR = "r0"
11 11
12SRC_URI = "${KERNELORG_MIRROR}/linux/utils/boot/syslinux/4.xx/syslinux-${PV}.tar.bz2 \ 12SRC_URI = "${KERNELORG_MIRROR}/linux/utils/boot/syslinux/4.xx/syslinux-${PV}.tar.bz2"
13 file://cross-build.patch \
14 file://no-strip.patch \
15 file://libinstaller-Avoid-using-linux-ext2_fs.h.patch"
16 13
17SRC_URI[md5sum] = "a7ca38a0a5786b6efae8fb01a1ae8070" 14SRC_URI[md5sum] = "0384ef35b724615074e77b1fc89d5b47"
18SRC_URI[sha256sum] = "c65567e324f9d1f7f794ae8f9578a0292bbd47d7b8d895a004d2f0152d0bda38" 15SRC_URI[sha256sum] = "dbb7774e36c4596de68fa5e6788ad57809ab31a1760e5d7626e697766d30ad26"
19 16
20COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)' 17COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)'
21 18
@@ -37,15 +34,15 @@ do_configure() {
37do_compile() { 34do_compile() {
38 # Rebuild only the installer; keep precompiled bootloaders 35 # Rebuild only the installer; keep precompiled bootloaders
39 # as per author's request (doc/distrib.txt) 36 # as per author's request (doc/distrib.txt)
40 oe_runmake CC="${CC}" installer 37 oe_runmake CC="${CC} ${CFLAGS}" LDFLAGS="${LDFLAGS}" installer
41} 38}
42 39
43do_install() { 40do_install() {
44 oe_runmake install INSTALLROOT="${D}" 41 oe_runmake install INSTALLROOT="${D}"
45 42
46 install -d ${D}${libdir}/syslinux/ 43 install -d ${D}${datadir}/syslinux/
47 install -m 644 ${S}/core/ldlinux.sys ${D}${libdir}/syslinux/ 44 install -m 644 ${S}/core/ldlinux.sys ${D}${datadir}/syslinux/
48 install -m 644 ${S}/core/ldlinux.bss ${D}${libdir}/syslinux/ 45 install -m 644 ${S}/core/ldlinux.bss ${D}${datadir}/syslinux/
49} 46}
50 47
51PACKAGES += "${PN}-extlinux ${PN}-mbr ${PN}-chain ${PN}-pxelinux ${PN}-isolinux ${PN}-misc" 48PACKAGES += "${PN}-extlinux ${PN}-mbr ${PN}-chain ${PN}-pxelinux ${PN}-isolinux ${PN}-misc"
@@ -54,12 +51,12 @@ RDEPENDS_${PN} += "mtools"
54 51
55FILES_${PN} = "${bindir}/syslinux" 52FILES_${PN} = "${bindir}/syslinux"
56FILES_${PN}-extlinux = "${sbindir}/extlinux" 53FILES_${PN}-extlinux = "${sbindir}/extlinux"
57FILES_${PN}-mbr = "${libdir}/${BPN}/mbr.bin" 54FILES_${PN}-mbr = "${datadir}/${BPN}/mbr.bin"
58FILES_${PN}-chain = "${libdir}/${BPN}/chain.c32" 55FILES_${PN}-chain = "${datadir}/${BPN}/chain.c32"
59FILES_${PN}-isolinux = "${libdir}/${BPN}/isolinux.bin" 56FILES_${PN}-isolinux = "${datadir}/${BPN}/isolinux.bin"
60FILES_${PN}-pxelinux = "${libdir}/${BPN}/pxelinux.0" 57FILES_${PN}-pxelinux = "${datadir}/${BPN}/pxelinux.0"
61FILES_${PN}-dev += "${datadir}/${BPN}/com32/lib*${SOLIBS} ${datadir}/${BPN}/com32/include ${datadir}/${BPN}/com32/com32.ld" 58FILES_${PN}-dev += "${datadir}/${BPN}/com32/lib*${SOLIBS} ${datadir}/${BPN}/com32/include ${datadir}/${BPN}/com32/com32.ld"
62FILES_${PN}-staticdev += "${datadir}/${BPN}/com32/lib*.a ${libdir}/${BPN}/com32/lib*.a" 59FILES_${PN}-staticdev += "${datadir}/${BPN}/com32/lib*.a ${libdir}/${BPN}/com32/lib*.a"
63FILES_${PN}-misc = "${libdir}/${BPN}/* ${bindir}/*" 60FILES_${PN}-misc = "${datadir}/${BPN}/* ${libdir}/${BPN}/* ${bindir}/*"
64 61
65BBCLASSEXTEND = "native" 62BBCLASSEXTEND = "native"