linux revision 159764
124139Sjoerg
289750Sdwmalone#------------------------------------------------------------------------------
324139Sjoerg# linux:  file(1) magic for Linux files
424139Sjoerg#
589750Sdwmalone# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
624139Sjoerg# The following basic Linux magic is useful for reference, but using
724139Sjoerg# "long" magic is a better practice in order to avoid collisions.
824139Sjoerg#
924139Sjoerg# 2	leshort		100		Linux/i386
1024139Sjoerg# >0	leshort		0407		impure executable (OMAGIC)
1124139Sjoerg# >0	leshort		0410		pure executable (NMAGIC)
1224139Sjoerg# >0	leshort		0413		demand-paged executable (ZMAGIC)
1324139Sjoerg# >0	leshort		0314		demand-paged executable (QMAGIC)
1424139Sjoerg#
1524139Sjoerg0	lelong		0x00640107	Linux/i386 impure executable (OMAGIC)
1624139Sjoerg>16	lelong		0		\b, stripped
1724139Sjoerg0	lelong		0x00640108	Linux/i386 pure executable (NMAGIC)
1824139Sjoerg>16	lelong		0		\b, stripped
1924139Sjoerg0	lelong		0x0064010b	Linux/i386 demand-paged executable (ZMAGIC)
2024139Sjoerg>16	lelong		0		\b, stripped
2124139Sjoerg0	lelong		0x006400cc	Linux/i386 demand-paged executable (QMAGIC)
2224139Sjoerg>16	lelong		0		\b, stripped
2324139Sjoerg#
2424139Sjoerg0	string		\007\001\000	Linux/i386 object file
2524139Sjoerg>20	lelong		>0x1020		\b, DLL library
2624139Sjoerg# Linux-8086 stuff:
2724139Sjoerg0	string		\01\03\020\04	Linux-8086 impure executable
2824139Sjoerg>28	long		!0		not stripped
2924139Sjoerg0	string		\01\03\040\04	Linux-8086 executable
3024139Sjoerg>28	long		!0		not stripped
3124139Sjoerg#
3224139Sjoerg0	string		\243\206\001\0	Linux-8086 object file
3324139Sjoerg#
3424139Sjoerg0	string		\01\03\020\20	Minix-386 impure executable
3524139Sjoerg>28	long		!0		not stripped
3624139Sjoerg0	string		\01\03\040\20	Minix-386 executable
3724139Sjoerg>28	long		!0		not stripped
3824139Sjoerg# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov>
3924139Sjoerg216	lelong		0421		Linux/i386 core file
4024139Sjoerg>220	string		>\0		of '%s'
4124139Sjoerg>200	lelong		>0		(signal %d)
4224139Sjoerg#
4324139Sjoerg# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com>
4424139Sjoerg# this can be overridden by the DOS executable (COM) entry
4524139Sjoerg2	string		LILO		Linux/i386 LILO boot/chain loader
4624139Sjoerg#
4724139Sjoerg# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
4824139Sjoerg0	leshort		0x0436		Linux/i386 PC Screen Font data,
4924139Sjoerg>2	byte		0		256 characters, no directory,
5024139Sjoerg>2	byte		1		512 characters, no directory,
5124139Sjoerg>2	byte		2		256 characters, Unicode directory,
5224139Sjoerg>2	byte		3		512 characters, Unicode directory,
5324139Sjoerg>3	byte		>0		8x%d
5424139Sjoerg# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com>
5524139Sjoerg4086	string		SWAP-SPACE	Linux/i386 swap file
5624139Sjoerg# From: Jeff Bailey <jbailey@ubuntu.com>
5724139Sjoerg# Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com>
5824139Sjoerg4076	string		SWAPSPACE2S1SUSPEND	Linux/i386 swap file (new style) with SWSUSP1 image
5924139Sjoerg# according to man page of mkswap (8) March 1999
6024139Sjoerg4086	string		SWAPSPACE2	Linux/i386 swap file (new style)
6124139Sjoerg>0x400	long		x		%d (4K pages)
6224139Sjoerg>0x404	long		x		size %d pages
6324139Sjoerg>>4086	string		SWAPSPACE2	
6424139Sjoerg>>>1052	string		>\0		Label %s
6524139Sjoerg# ECOFF magic for OSF/1 and Linux (only tested under Linux though)
6624139Sjoerg#
6724139Sjoerg#	from Erik Troan (ewt@redhat.com) examining od dumps, so this
6824139Sjoerg#		could be wrong
6924139Sjoerg#      updated by David Mosberger (davidm@azstarnet.com) based on
7024139Sjoerg#      GNU BFD and MIPS info found below.
7124139Sjoerg#
7224139Sjoerg0	leshort		0x0183		ECOFF alpha
7324139Sjoerg>24	leshort		0407		executable
7424139Sjoerg>24	leshort		0410		pure
7524139Sjoerg>24	leshort		0413		demand paged
7624139Sjoerg>8	long		>0		not stripped
7724139Sjoerg>8	long		0		stripped
7824139Sjoerg>23	leshort		>0		- version %ld.
7924139Sjoerg#
8024139Sjoerg# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>
8124139Sjoerg# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de>
8224139Sjoerg# and Nicol�s Lichtmaier <nick@debian.org>
8324139Sjoerg# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
8424139Sjoerg# Linux kernel boot images (i386 arch) (Wolfram Kleff)
8524139Sjoerg514	string		HdrS		Linux kernel
8624139Sjoerg>510	leshort		0xAA55		x86 boot executable
8724139Sjoerg>>518	leshort		>=0x200
8824139Sjoerg>>529	byte		0		zImage,
8924139Sjoerg>>>529	byte		1		bzImage,
9024139Sjoerg>>>(526.s+0x200) string	>\0		version %s,
9124139Sjoerg>>498	leshort		1		RO-rootFS,
9224139Sjoerg>>498	leshort		0		RW-rootFS,
9324139Sjoerg>>508	leshort		>0		root_dev 0x%X,
9424139Sjoerg>>502	leshort		>0		swap_dev 0x%X,
9524139Sjoerg>>504	leshort		>0		RAMdisksize %u KB,
9624139Sjoerg>>506	leshort		0xFFFF		Normal VGA
9724139Sjoerg>>506	leshort		0xFFFE		Extended VGA
9824139Sjoerg>>506	leshort		0xFFFD		Prompt for Videomode
9924139Sjoerg>>506	leshort		>0		Video mode %d
10089750Sdwmalone# This also matches new kernels, which were caught above by "HdrS".
10189750Sdwmalone0		belong	0xb8c0078e	Linux kernel
10224139Sjoerg>0x1e3		string	Loading		version 1.3.79 or older
10389750Sdwmalone>0x1e9		string	Loading		from prehistoric times
10424139Sjoerg
10524139Sjoerg# System.map files - Nicol�s Lichtmaier <nick@debian.org>
10624139Sjoerg8	string	\ A\ _text	Linux kernel symbol map text
10724139Sjoerg
10824139Sjoerg# LSM entries - Nicol�s Lichtmaier <nick@debian.org>
10924139Sjoerg0	string	Begin3	Linux Software Map entry text
11024139Sjoerg0	string	Begin4	Linux Software Map entry text (new format)
11124139Sjoerg
11224139Sjoerg# From Matt Zimmerman
11324139Sjoerg0       belong  0x4f4f4f4d      User-mode Linux COW file
11424139Sjoerg>4      belong  x               \b, version %d
11524139Sjoerg>8      string  >\0             \b, backing file %s
11624139Sjoerg
11724139Sjoerg############################################################################
11824139Sjoerg# Linux kernel versions
11924139Sjoerg
12024139Sjoerg0		string		\xb8\xc0\x07\x8e\xd8\xb8\x00\x90	Linux
12124139Sjoerg>497		leshort		0		x86 boot sector
12224139Sjoerg>>514		belong		0x8e	of a kernel from the dawn of time!
12324139Sjoerg>>514		belong		0x908ed8b4	version 0.99-1.1.42
12424139Sjoerg>>514		belong		0x908ed8b8	for memtest86
12524139Sjoerg
12624139Sjoerg>497		leshort		!0		x86 kernel
12724139Sjoerg>>504		leshort		>0		RAMdisksize=%u KB
12824139Sjoerg>>502		leshort		>0		swap=0x%X
12924139Sjoerg>>508		leshort		>0		root=0x%X
13024139Sjoerg>>>498		leshort		1		\b-ro
13124139Sjoerg>>>498		leshort		0		\b-rw
13224139Sjoerg>>506		leshort		0xFFFF		vga=normal
13324139Sjoerg>>506		leshort		0xFFFE		vga=extended
13424139Sjoerg>>506		leshort		0xFFFD		vga=ask
13524139Sjoerg>>506		leshort		>0		vga=%d
13624139Sjoerg>>514		belong		0x908ed881	version 1.1.43-1.1.45
13724139Sjoerg>>514		belong		0x15b281cd
13824139Sjoerg>>>0xa8e	belong		0x55AA5a5a	version 1.1.46-1.2.13,1.3.0
13924139Sjoerg>>>0xa99	belong		0x55AA5a5a	version 1.3.1,2
14024139Sjoerg>>>0xaa3	belong		0x55AA5a5a	version 1.3.3-1.3.30
14124139Sjoerg>>>0xaa6	belong		0x55AA5a5a	version 1.3.31-1.3.41
14224139Sjoerg>>>0xb2b	belong		0x55AA5a5a	version 1.3.42-1.3.45
14324139Sjoerg>>>0xaf7	belong		0x55AA5a5a	version 1.3.46-1.3.72
14424139Sjoerg>>514		string		HdrS
14524139Sjoerg>>>518		leshort		>0x1FF
14624139Sjoerg>>>>529		byte		0		\b, zImage
14724139Sjoerg>>>>529		byte		1		\b, bzImage
14824139Sjoerg>>>>(526.s+0x200) string 	>\0		\b, version %s
14924139Sjoerg
15024139Sjoerg# Linux boot sector thefts.
15124139Sjoerg0		belong		0xb8c0078e	Linux
15224139Sjoerg>0x1e6		belong		0x454c4b53	ELKS Kernel
15324139Sjoerg>0x1e6		belong		!0x454c4b53	style boot sector
15424139Sjoerg
15524139Sjoerg############################################################################
15624139Sjoerg# Linux 8086 executable
15724139Sjoerg0	lelong&0xFF0000FF 0xC30000E9	Linux-Dev86 executable, headerless
15824139Sjoerg>5	string		.		
15924139Sjoerg>>4	string		>\0		\b, libc version %s
16024139Sjoerg
16124139Sjoerg0	lelong&0xFF00FFFF 0x4000301	Linux-8086 executable
16224139Sjoerg>2	byte&0x01	!0		\b, unmapped zero page
16324139Sjoerg>2	byte&0x20	0		\b, impure
16424139Sjoerg>2	byte&0x20	!0
16524139Sjoerg>>2	byte&0x10	!0		\b, A_EXEC
16624139Sjoerg>2	byte&0x02	!0		\b, A_PAL
167>2	byte&0x04	!0		\b, A_NSYM
168>2	byte&0x08	!0		\b, A_STAND
169>2	byte&0x40	!0		\b, A_PURE
170>2	byte&0x80	!0		\b, A_TOVLY
171>28     long            !0              \b, not stripped
172>37	string		.		
173>>36	string		>\0		\b, libc version %s
174
175# 0	lelong&0xFF00FFFF 0x10000301	ld86 I80386 executable
176# 0	lelong&0xFF00FFFF 0xB000301	ld86 M68K executable
177# 0	lelong&0xFF00FFFF 0xC000301	ld86 NS16K executable
178# 0	lelong&0xFF00FFFF 0x17000301	ld86 SPARC executable
179
180# SYSLINUX boot logo files (from 'ppmtolss16' sources)
181# http://syslinux.zytor.com/
182#
1830	lelong	=0x1413f33d		SYSLINUX' LSS16 image data
184>4	leshort	x			\b, width %d
185>6	leshort	x			\b, height %d
186
1870	string	OOOM			User-Mode-Linux's Copy-On-Write disk image
188>4	belong	x			version %d
189
190# SE Linux policy database
191# From: Mike Frysinger <vapier@gentoo.org>
1920	lelong	0xf97cff8c		SE Linux policy
193>16	lelong	x			v%d
194>20	lelong	1			MLS
195>24	lelong	x			%d symbols
196>28	lelong	x			%d ocons
197
198# Linux Logical Volume Manager (LVM) 
199# Emmanuel VARAGNAT <emmanuel.varagnat@guzu.net>
200#
201# System ID, UUID and volume group name are 128 bytes long
202# but they should never be full and initialized with zeros...
203#
204# LVM1
205#
2060x0	string	HM\001		LVM1 (Linux Logical Volume Manager), version 1
207>0x12c	string	>\0		, System ID: %s
208
2090x0	string	HM\002		LVM1 (Linux Logical Volume Manager), version 2
210>0x12c	string	>\0		, System ID: %s
211
212#  LVM2
213#
214# It seems that the label header can be in one the four first sector
215# of the disk... (from _find_labeller in lib/label/label.c of LVM2)
216#
217# 0x200 seems to be the common case
218
2190x218		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
220# read the offset to add to the start of the header, and the header
221# start in 0x200
222>(0x214.l+0x200) string	>\0		, UUID: %s
223
2240x018		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
225>(0x014.l)	 string	>\0		, UUID: %s
226
2270x418		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
228>(0x414.l+0x400) string	>\0		, UUID: %s
229
2300x618		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
231>(0x614.l+0x600) string	>\0		, UUID: %s
232