xref: /openbsd-src/usr.bin/file/magdir/linux (revision 0ee74395949c27152548431c5cb896cb486a0866)
1*0ee74395Schl#	$OpenBSD: linux,v 1.6 2009/04/24 18:54:34 chl Exp $
2df930be7Sderaadt
3df930be7Sderaadt#------------------------------------------------------------------------------
4df930be7Sderaadt# linux:  file(1) magic for Linux files
5df930be7Sderaadt#
6df930be7Sderaadt# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
7df930be7Sderaadt# The following basic Linux magic is useful for reference, but using
8df930be7Sderaadt# "long" magic is a better practice in order to avoid collisions.
9df930be7Sderaadt#
10df930be7Sderaadt# 2	leshort		100		Linux/i386
11df930be7Sderaadt# >0	leshort		0407		impure executable (OMAGIC)
12df930be7Sderaadt# >0	leshort		0410		pure executable (NMAGIC)
13df930be7Sderaadt# >0	leshort		0413		demand-paged executable (ZMAGIC)
14df930be7Sderaadt# >0	leshort		0314		demand-paged executable (QMAGIC)
15df930be7Sderaadt#
16df930be7Sderaadt0	lelong		0x00640107	Linux/i386 impure executable (OMAGIC)
17e2a32a0eSderaadt>16	lelong		0		\b, stripped
18df930be7Sderaadt0	lelong		0x00640108	Linux/i386 pure executable (NMAGIC)
19e2a32a0eSderaadt>16	lelong		0		\b, stripped
20df930be7Sderaadt0	lelong		0x0064010b	Linux/i386 demand-paged executable (ZMAGIC)
21e2a32a0eSderaadt>16	lelong		0		\b, stripped
22df930be7Sderaadt0	lelong		0x006400cc	Linux/i386 demand-paged executable (QMAGIC)
23e2a32a0eSderaadt>16	lelong		0		\b, stripped
24df930be7Sderaadt#
25df930be7Sderaadt0	string		\007\001\000	Linux/i386 object file
26e2a32a0eSderaadt>20	lelong		>0x1020		\b, DLL library
2736c0c0feStedu# Linux-8086 stuff:
2836c0c0feStedu0	string		\01\03\020\04	Linux-8086 impure executable
2936c0c0feStedu>28	long		!0		not stripped
3036c0c0feStedu0	string		\01\03\040\04	Linux-8086 executable
3136c0c0feStedu>28	long		!0		not stripped
3236c0c0feStedu#
3336c0c0feStedu0	string		\243\206\001\0	Linux-8086 object file
3436c0c0feStedu#
3536c0c0feStedu0	string		\01\03\020\20	Minix-386 impure executable
3636c0c0feStedu>28	long		!0		not stripped
3736c0c0feStedu0	string		\01\03\040\20	Minix-386 executable
3836c0c0feStedu>28	long		!0		not stripped
39df930be7Sderaadt# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov>
40df930be7Sderaadt216	lelong		0421		Linux/i386 core file
41df930be7Sderaadt>220	string		>\0		of '%s'
42df930be7Sderaadt>200	lelong		>0		(signal %d)
43df930be7Sderaadt#
44df930be7Sderaadt# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com>
45df930be7Sderaadt# this can be overridden by the DOS executable (COM) entry
46df930be7Sderaadt2	string		LILO		Linux/i386 LILO boot/chain loader
47df930be7Sderaadt#
48df930be7Sderaadt# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
49e2a32a0eSderaadt0	leshort		0x0436		Linux/i386 PC Screen Font data,
50e2a32a0eSderaadt>2	byte		0		256 characters, no directory,
51e2a32a0eSderaadt>2	byte		1		512 characters, no directory,
52e2a32a0eSderaadt>2	byte		2		256 characters, Unicode directory,
53e2a32a0eSderaadt>2	byte		3		512 characters, Unicode directory,
54df930be7Sderaadt>3	byte		>0		8x%d
55df930be7Sderaadt# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com>
56df930be7Sderaadt4086	string		SWAP-SPACE	Linux/i386 swap file
57380b5c7dSchl# From: Jeff Bailey <jbailey@ubuntu.com>
58380b5c7dSchl# Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com>
59380b5c7dSchl4076	string		SWAPSPACE2S1SUSPEND	Linux/i386 swap file (new style) with SWSUSP1 image
6036c0c0feStedu# according to man page of mkswap (8) March 1999
6136c0c0feStedu4086	string		SWAPSPACE2	Linux/i386 swap file (new style)
6236c0c0feStedu>0x400	long		x		%d (4K pages)
6336c0c0feStedu>0x404	long		x		size %d pages
64380b5c7dSchl>>4086	string		SWAPSPACE2
65380b5c7dSchl>>>1052	string		>\0		Label %s
66ab0f8c09Smillert# ECOFF magic for OSF/1 and Linux (only tested under Linux though)
67ab0f8c09Smillert#
68ab0f8c09Smillert#	from Erik Troan (ewt@redhat.com) examining od dumps, so this
69ab0f8c09Smillert#		could be wrong
70ab0f8c09Smillert#      updated by David Mosberger (davidm@azstarnet.com) based on
71ab0f8c09Smillert#      GNU BFD and MIPS info found below.
72ab0f8c09Smillert#
73ab0f8c09Smillert0	leshort		0x0183		ECOFF alpha
74ab0f8c09Smillert>24	leshort		0407		executable
75ab0f8c09Smillert>24	leshort		0410		pure
76ab0f8c09Smillert>24	leshort		0413		demand paged
77ab0f8c09Smillert>8	long		>0		not stripped
78ab0f8c09Smillert>8	long		0		stripped
79ab0f8c09Smillert>23	leshort		>0		- version %ld.
80ab0f8c09Smillert#
8136c0c0feStedu# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>
8236c0c0feStedu# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de>
8336c0c0feStedu# and Nicol�s Lichtmaier <nick@debian.org>
8436c0c0feStedu# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
8536c0c0feStedu# Linux kernel boot images (i386 arch) (Wolfram Kleff)
8636c0c0feStedu514	string		HdrS		Linux kernel
8736c0c0feStedu>510	leshort		0xAA55		x86 boot executable
88380b5c7dSchl>>518	leshort		>=0x200
8936c0c0feStedu>>529	byte		0		zImage,
9036c0c0feStedu>>>529	byte		1		bzImage,
9136c0c0feStedu>>>(526.s+0x200) string	>\0		version %s,
9236c0c0feStedu>>498	leshort		1		RO-rootFS,
9336c0c0feStedu>>498	leshort		0		RW-rootFS,
9436c0c0feStedu>>508	leshort		>0		root_dev 0x%X,
9536c0c0feStedu>>502	leshort		>0		swap_dev 0x%X,
9636c0c0feStedu>>504	leshort		>0		RAMdisksize %u KB,
9736c0c0feStedu>>506	leshort		0xFFFF		Normal VGA
9836c0c0feStedu>>506	leshort		0xFFFE		Extended VGA
9936c0c0feStedu>>506	leshort		0xFFFD		Prompt for Videomode
10036c0c0feStedu>>506	leshort		>0		Video mode %d
10136c0c0feStedu# This also matches new kernels, which were caught above by "HdrS".
10236c0c0feStedu0		belong	0xb8c0078e	Linux kernel
10336c0c0feStedu>0x1e3		string	Loading		version 1.3.79 or older
10436c0c0feStedu>0x1e9		string	Loading		from prehistoric times
10536c0c0feStedu
10636c0c0feStedu# System.map files - Nicol�s Lichtmaier <nick@debian.org>
107*0ee74395Schl8	search/1	\ A\ _text	Linux kernel symbol map text
10836c0c0feStedu
10936c0c0feStedu# LSM entries - Nicol�s Lichtmaier <nick@debian.org>
110*0ee74395Schl0	search/1	Begin3	Linux Software Map entry text
111*0ee74395Schl0	search/1	Begin4	Linux Software Map entry text (new format)
11236c0c0feStedu
113*0ee74395Schl# From Matt Zimmerman, enhanced for v3 by Matthew Palmer
11436c0c0feStedu0	belong	0x4f4f4f4d	User-mode Linux COW file
115*0ee74395Schl>4	belong	<3		\b, version %d
116*0ee74395Schl>>8	string	>\0		\b, backing file %s
117*0ee74395Schl>4	belong	>2		\b, version %d
118*0ee74395Schl>>32	string	>\0		\b, backing file %s
11936c0c0feStedu
12036c0c0feStedu############################################################################
12136c0c0feStedu# Linux kernel versions
12236c0c0feStedu
12336c0c0feStedu0		string		\xb8\xc0\x07\x8e\xd8\xb8\x00\x90	Linux
12436c0c0feStedu>497		leshort		0		x86 boot sector
12536c0c0feStedu>>514		belong		0x8e	of a kernel from the dawn of time!
12636c0c0feStedu>>514		belong		0x908ed8b4	version 0.99-1.1.42
12736c0c0feStedu>>514		belong		0x908ed8b8	for memtest86
12836c0c0feStedu
12936c0c0feStedu>497		leshort		!0		x86 kernel
13036c0c0feStedu>>504		leshort		>0		RAMdisksize=%u KB
13136c0c0feStedu>>502		leshort		>0		swap=0x%X
13236c0c0feStedu>>508		leshort		>0		root=0x%X
13336c0c0feStedu>>>498		leshort		1		\b-ro
13436c0c0feStedu>>>498		leshort		0		\b-rw
13536c0c0feStedu>>506		leshort		0xFFFF		vga=normal
13636c0c0feStedu>>506		leshort		0xFFFE		vga=extended
13736c0c0feStedu>>506		leshort		0xFFFD		vga=ask
13836c0c0feStedu>>506		leshort		>0		vga=%d
13936c0c0feStedu>>514		belong		0x908ed881	version 1.1.43-1.1.45
14036c0c0feStedu>>514		belong		0x15b281cd
14136c0c0feStedu>>>0xa8e	belong		0x55AA5a5a	version 1.1.46-1.2.13,1.3.0
14236c0c0feStedu>>>0xa99	belong		0x55AA5a5a	version 1.3.1,2
14336c0c0feStedu>>>0xaa3	belong		0x55AA5a5a	version 1.3.3-1.3.30
14436c0c0feStedu>>>0xaa6	belong		0x55AA5a5a	version 1.3.31-1.3.41
14536c0c0feStedu>>>0xb2b	belong		0x55AA5a5a	version 1.3.42-1.3.45
14636c0c0feStedu>>>0xaf7	belong		0x55AA5a5a	version 1.3.46-1.3.72
14736c0c0feStedu>>514		string		HdrS
14836c0c0feStedu>>>518		leshort		>0x1FF
14936c0c0feStedu>>>>529		byte		0		\b, zImage
15036c0c0feStedu>>>>529		byte		1		\b, bzImage
15136c0c0feStedu>>>>(526.s+0x200) string 	>\0		\b, version %s
15236c0c0feStedu
15336c0c0feStedu# Linux boot sector thefts.
15436c0c0feStedu0		belong		0xb8c0078e	Linux
15536c0c0feStedu>0x1e6		belong		0x454c4b53	ELKS Kernel
15636c0c0feStedu>0x1e6		belong		!0x454c4b53	style boot sector
15736c0c0feStedu
15836c0c0feStedu############################################################################
15936c0c0feStedu# Linux 8086 executable
16036c0c0feStedu0	lelong&0xFF0000FF 0xC30000E9	Linux-Dev86 executable, headerless
16136c0c0feStedu>5	string		.
16236c0c0feStedu>>4	string		>\0		\b, libc version %s
16336c0c0feStedu
16436c0c0feStedu0	lelong&0xFF00FFFF 0x4000301	Linux-8086 executable
16536c0c0feStedu>2	byte&0x01	!0		\b, unmapped zero page
16636c0c0feStedu>2	byte&0x20	0		\b, impure
16736c0c0feStedu>2	byte&0x20	!0
16836c0c0feStedu>>2	byte&0x10	!0		\b, A_EXEC
16936c0c0feStedu>2	byte&0x02	!0		\b, A_PAL
17036c0c0feStedu>2	byte&0x04	!0		\b, A_NSYM
17136c0c0feStedu>2	byte&0x08	!0		\b, A_STAND
17236c0c0feStedu>2	byte&0x40	!0		\b, A_PURE
17336c0c0feStedu>2	byte&0x80	!0		\b, A_TOVLY
17436c0c0feStedu>28     long            !0              \b, not stripped
17536c0c0feStedu>37	string		.
17636c0c0feStedu>>36	string		>\0		\b, libc version %s
17736c0c0feStedu
17836c0c0feStedu# 0	lelong&0xFF00FFFF 0x10000301	ld86 I80386 executable
17936c0c0feStedu# 0	lelong&0xFF00FFFF 0xB000301	ld86 M68K executable
18036c0c0feStedu# 0	lelong&0xFF00FFFF 0xC000301	ld86 NS16K executable
18136c0c0feStedu# 0	lelong&0xFF00FFFF 0x17000301	ld86 SPARC executable
18236c0c0feStedu
183380b5c7dSchl# SYSLINUX boot logo files (from 'ppmtolss16' sources)
184380b5c7dSchl# http://syslinux.zytor.com/
185380b5c7dSchl#
186380b5c7dSchl0	lelong	=0x1413f33d		SYSLINUX' LSS16 image data
187380b5c7dSchl>4	leshort	x			\b, width %d
188380b5c7dSchl>6	leshort	x			\b, height %d
189380b5c7dSchl
190380b5c7dSchl0	string	OOOM			User-Mode-Linux's Copy-On-Write disk image
191380b5c7dSchl>4	belong	x			version %d
192380b5c7dSchl
193380b5c7dSchl# SE Linux policy database
194380b5c7dSchl# From: Mike Frysinger <vapier@gentoo.org>
195380b5c7dSchl0	lelong	0xf97cff8c		SE Linux policy
196380b5c7dSchl>16	lelong	x			v%d
197380b5c7dSchl>20	lelong	1			MLS
198380b5c7dSchl>24	lelong	x			%d symbols
199380b5c7dSchl>28	lelong	x			%d ocons
200380b5c7dSchl
201380b5c7dSchl# Linux Logical Volume Manager (LVM)
202380b5c7dSchl# Emmanuel VARAGNAT <emmanuel.varagnat@guzu.net>
203380b5c7dSchl#
204380b5c7dSchl# System ID, UUID and volume group name are 128 bytes long
205380b5c7dSchl# but they should never be full and initialized with zeros...
206380b5c7dSchl#
207380b5c7dSchl# LVM1
208380b5c7dSchl#
209380b5c7dSchl0x0	string	HM\001		LVM1 (Linux Logical Volume Manager), version 1
210380b5c7dSchl>0x12c	string	>\0		, System ID: %s
211380b5c7dSchl
212380b5c7dSchl0x0	string	HM\002		LVM1 (Linux Logical Volume Manager), version 2
213380b5c7dSchl>0x12c	string	>\0		, System ID: %s
214380b5c7dSchl
215380b5c7dSchl#  LVM2
216380b5c7dSchl#
217380b5c7dSchl# It seems that the label header can be in one the four first sector
218380b5c7dSchl# of the disk... (from _find_labeller in lib/label/label.c of LVM2)
219380b5c7dSchl#
220380b5c7dSchl# 0x200 seems to be the common case
221380b5c7dSchl
222380b5c7dSchl0x218		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
223380b5c7dSchl# read the offset to add to the start of the header, and the header
224380b5c7dSchl# start in 0x200
225380b5c7dSchl>(0x214.l+0x200) string	>\0		, UUID: %s
226380b5c7dSchl
227380b5c7dSchl0x018		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
228380b5c7dSchl>(0x014.l)	 string	>\0		, UUID: %s
229380b5c7dSchl
230380b5c7dSchl0x418		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
231380b5c7dSchl>(0x414.l+0x400) string	>\0		, UUID: %s
232380b5c7dSchl
233380b5c7dSchl0x618		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
234380b5c7dSchl>(0x614.l+0x600) string	>\0		, UUID: %s
235380b5c7dSchl
236380b5c7dSchl# SE Linux policy database
237380b5c7dSchl0	lelong	0xf97cff8c		SE Linux policy
238380b5c7dSchl>16	lelong	x			v%d
239380b5c7dSchl>20	lelong	1			MLS
240380b5c7dSchl>24	lelong	x			%d symbols
241380b5c7dSchl>28	lelong	x			%d ocons
242380b5c7dSchl
243380b5c7dSchl# LUKS: Linux Unified Key Setup, On-Disk Format, http://luks.endorphin.org/spec
244380b5c7dSchl# Anthon van der Neut (anthon@mnt.org)
245380b5c7dSchl0	string	LUKS\xba\xbe	LUKS encrypted file,
246380b5c7dSchl>6	beshort x		ver %d
247380b5c7dSchl>8	string	x		[%s,
248380b5c7dSchl>40	string	x		%s,
249380b5c7dSchl>72	string	x		%s]
250380b5c7dSchl>168	string	x		UUID: %s
251380b5c7dSchl
252