linux revision 139368
1247738Sbapt 2247738Sbapt#------------------------------------------------------------------------------ 3247738Sbapt# linux: file(1) magic for Linux files 4247738Sbapt# 5247738Sbapt# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com> 6247738Sbapt# The following basic Linux magic is useful for reference, but using 7247738Sbapt# "long" magic is a better practice in order to avoid collisions. 8247738Sbapt# 9247738Sbapt# 2 leshort 100 Linux/i386 10247738Sbapt# >0 leshort 0407 impure executable (OMAGIC) 11247738Sbapt# >0 leshort 0410 pure executable (NMAGIC) 12247738Sbapt# >0 leshort 0413 demand-paged executable (ZMAGIC) 13247738Sbapt# >0 leshort 0314 demand-paged executable (QMAGIC) 14247738Sbapt# 15247738Sbapt0 lelong 0x00640107 Linux/i386 impure executable (OMAGIC) 16247738Sbapt>16 lelong 0 \b, stripped 17247738Sbapt0 lelong 0x00640108 Linux/i386 pure executable (NMAGIC) 18247738Sbapt>16 lelong 0 \b, stripped 19247738Sbapt0 lelong 0x0064010b Linux/i386 demand-paged executable (ZMAGIC) 20247738Sbapt>16 lelong 0 \b, stripped 21247738Sbapt0 lelong 0x006400cc Linux/i386 demand-paged executable (QMAGIC) 22247738Sbapt>16 lelong 0 \b, stripped 23247738Sbapt# 24247738Sbapt0 string \007\001\000 Linux/i386 object file 25247738Sbapt>20 lelong >0x1020 \b, DLL library 26247738Sbapt# Linux-8086 stuff: 27247738Sbapt0 string \01\03\020\04 Linux-8086 impure executable 28247738Sbapt>28 long !0 not stripped 29247738Sbapt0 string \01\03\040\04 Linux-8086 executable 30247738Sbapt>28 long !0 not stripped 31247738Sbapt# 32247738Sbapt0 string \243\206\001\0 Linux-8086 object file 33247738Sbapt# 34247738Sbapt0 string \01\03\020\20 Minix-386 impure executable 35247738Sbapt>28 long !0 not stripped 36247738Sbapt0 string \01\03\040\20 Minix-386 executable 37247738Sbapt>28 long !0 not stripped 38247738Sbapt# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov> 39247738Sbapt216 lelong 0421 Linux/i386 core file 40247738Sbapt>220 string >\0 of '%s' 41247738Sbapt>200 lelong >0 (signal %d) 42247738Sbapt# 43247738Sbapt# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com> 44247738Sbapt# this can be overridden by the DOS executable (COM) entry 45247738Sbapt2 string LILO Linux/i386 LILO boot/chain loader 46247738Sbapt# 47247738Sbapt# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com> 48247738Sbapt0 leshort 0x0436 Linux/i386 PC Screen Font data, 49247738Sbapt>2 byte 0 256 characters, no directory, 50247738Sbapt>2 byte 1 512 characters, no directory, 51247738Sbapt>2 byte 2 256 characters, Unicode directory, 52247738Sbapt>2 byte 3 512 characters, Unicode directory, 53247738Sbapt>3 byte >0 8x%d 54247738Sbapt# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com> 55247738Sbapt4086 string SWAP-SPACE Linux/i386 swap file 56247738Sbapt# according to man page of mkswap (8) March 1999 57247738Sbapt4086 string SWAPSPACE2 Linux/i386 swap file (new style) 58247738Sbapt>0x400 long x %d (4K pages) 59247738Sbapt>0x404 long x size %d pages 60247738Sbapt# ECOFF magic for OSF/1 and Linux (only tested under Linux though) 61247738Sbapt# 62247738Sbapt# from Erik Troan (ewt@redhat.com) examining od dumps, so this 63247738Sbapt# could be wrong 64247738Sbapt# updated by David Mosberger (davidm@azstarnet.com) based on 65247738Sbapt# GNU BFD and MIPS info found below. 66247738Sbapt# 67247738Sbapt0 leshort 0x0183 ECOFF alpha 68247738Sbapt>24 leshort 0407 executable 69247738Sbapt>24 leshort 0410 pure 70247738Sbapt>24 leshort 0413 demand paged 71247738Sbapt>8 long >0 not stripped 72247738Sbapt>8 long 0 stripped 73247738Sbapt>23 leshort >0 - version %ld. 74247738Sbapt# 75247738Sbapt# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu> 76247738Sbapt# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de> 77247738Sbapt# and Nicol�s Lichtmaier <nick@debian.org> 78247738Sbapt# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29 79247738Sbapt# Linux kernel boot images (i386 arch) (Wolfram Kleff) 80247738Sbapt514 string HdrS Linux kernel 81247738Sbapt>510 leshort 0xAA55 x86 boot executable 82247738Sbapt>>518 leshort >=3D0x200 83247738Sbapt>>529 byte 0 zImage, 84247738Sbapt>>>529 byte 1 bzImage, 85247738Sbapt>>>(526.s+0x200) string >\0 version %s, 86247738Sbapt>>498 leshort 1 RO-rootFS, 87247738Sbapt>>498 leshort 0 RW-rootFS, 88247738Sbapt>>508 leshort >0 root_dev 0x%X, 89247738Sbapt>>502 leshort >0 swap_dev 0x%X, 90247738Sbapt>>504 leshort >0 RAMdisksize %u KB, 91247738Sbapt>>506 leshort 0xFFFF Normal VGA 92>>506 leshort 0xFFFE Extended VGA 93>>506 leshort 0xFFFD Prompt for Videomode 94>>506 leshort >0 Video mode %d 95# This also matches new kernels, which were caught above by "HdrS". 960 belong 0xb8c0078e Linux kernel 97>0x1e3 string Loading version 1.3.79 or older 98>0x1e9 string Loading from prehistoric times 99 100# System.map files - Nicol�s Lichtmaier <nick@debian.org> 1018 string \ A\ _text Linux kernel symbol map text 102 103# LSM entries - Nicol�s Lichtmaier <nick@debian.org> 1040 string Begin3 Linux Software Map entry text 1050 string Begin4 Linux Software Map entry text (new format) 106 107# From Matt Zimmerman 1080 belong 0x4f4f4f4d User-mode Linux COW file 109>4 belong x \b, version %d 110>8 string >\0 \b, backing file %s 111 112############################################################################ 113# Linux kernel versions 114 1150 string \xb8\xc0\x07\x8e\xd8\xb8\x00\x90 Linux 116>497 leshort 0 x86 boot sector 117>>514 belong 0x8e of a kernel from the dawn of time! 118>>514 belong 0x908ed8b4 version 0.99-1.1.42 119>>514 belong 0x908ed8b8 for memtest86 120 121>497 leshort !0 x86 kernel 122>>504 leshort >0 RAMdisksize=%u KB 123>>502 leshort >0 swap=0x%X 124>>508 leshort >0 root=0x%X 125>>>498 leshort 1 \b-ro 126>>>498 leshort 0 \b-rw 127>>506 leshort 0xFFFF vga=normal 128>>506 leshort 0xFFFE vga=extended 129>>506 leshort 0xFFFD vga=ask 130>>506 leshort >0 vga=%d 131>>514 belong 0x908ed881 version 1.1.43-1.1.45 132>>514 belong 0x15b281cd 133>>>0xa8e belong 0x55AA5a5a version 1.1.46-1.2.13,1.3.0 134>>>0xa99 belong 0x55AA5a5a version 1.3.1,2 135>>>0xaa3 belong 0x55AA5a5a version 1.3.3-1.3.30 136>>>0xaa6 belong 0x55AA5a5a version 1.3.31-1.3.41 137>>>0xb2b belong 0x55AA5a5a version 1.3.42-1.3.45 138>>>0xaf7 belong 0x55AA5a5a version 1.3.46-1.3.72 139>>514 string HdrS 140>>>518 leshort >0x1FF 141>>>>529 byte 0 \b, zImage 142>>>>529 byte 1 \b, bzImage 143>>>>(526.s+0x200) string >\0 \b, version %s 144 145# Linux boot sector thefts. 1460 belong 0xb8c0078e Linux 147>0x1e6 belong 0x454c4b53 ELKS Kernel 148>0x1e6 belong !0x454c4b53 style boot sector 149 150############################################################################ 151# Linux 8086 executable 1520 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless 153>5 string . 154>>4 string >\0 \b, libc version %s 155 1560 lelong&0xFF00FFFF 0x4000301 Linux-8086 executable 157>2 byte&0x01 !0 \b, unmapped zero page 158>2 byte&0x20 0 \b, impure 159>2 byte&0x20 !0 160>>2 byte&0x10 !0 \b, A_EXEC 161>2 byte&0x02 !0 \b, A_PAL 162>2 byte&0x04 !0 \b, A_NSYM 163>2 byte&0x08 !0 \b, A_STAND 164>2 byte&0x40 !0 \b, A_PURE 165>2 byte&0x80 !0 \b, A_TOVLY 166>28 long !0 \b, not stripped 167>37 string . 168>>36 string >\0 \b, libc version %s 169 170# 0 lelong&0xFF00FFFF 0x10000301 ld86 I80386 executable 171# 0 lelong&0xFF00FFFF 0xB000301 ld86 M68K executable 172# 0 lelong&0xFF00FFFF 0xC000301 ld86 NS16K executable 173# 0 lelong&0xFF00FFFF 0x17000301 ld86 SPARC executable 174 175# SYSLINUX boot logo files (from 'ppmtolss16' sources) 176# http://syslinux.zytor.com/ 177# 1780 lelong =0x1413f33d SYSLINUX' LSS16 image data 179>4 leshort x \b, width %d 180>6 leshort x \b, height %d 181