3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #define LINUX_LOADER_TYPE_LILO 0x01
27 #define LINUX_LOADER_TYPE_LOADLIN 0x11
28 #define LINUX_LOADER_TYPE_BOOTSECT 0x21
29 #define LINUX_LOADER_TYPE_SYSLINUX 0x31
30 #define LINUX_LOADER_TYPE_ETHERBOOT 0x41
31 #define LINUX_LOADER_TYPE_FREELOADER 0x81
33 #define LINUX_COMMAND_LINE_MAGIC 0xA33F
35 #define LINUX_SETUP_HEADER_ID 0x53726448 // 'HdrS'
37 #define LINUX_BOOT_SECTOR_MAGIC 0xAA55
39 #define LINUX_KERNEL_LOAD_ADDRESS 0x100000
41 #define LINUX_FLAG_LOAD_HIGH 0x01
42 #define LINUX_FLAG_CAN_USE_HEAP 0x80
44 #define LINUX_MAX_INITRD_ADDRESS 0x38000000
49 UCHAR BootCode1
[0x20];
51 USHORT CommandLineMagic
;
52 USHORT CommandLineOffset
;
54 UCHAR BootCode2
[0x1CD];
63 USHORT BootFlag
; // 0xAA55
65 } LINUX_BOOTSECTOR
, *PLINUX_BOOTSECTOR
;
69 UCHAR JumpInstruction
[2];
70 ULONG SetupHeaderSignature
; // Signature for SETUP-header
71 USHORT Version
; // Version number of header format
72 USHORT RealModeSwitch
; // Default switch
73 USHORT SetupSeg
; // SETUPSEG
74 USHORT StartSystemSeg
;
75 USHORT KernelVersion
; // Offset to kernel version string
76 UCHAR TypeOfLoader
; // Loader ID
77 // =0, old one (LILO, Loadlin,
78 // Bootlin, SYSLX, bootsect...)
79 // else it is set by the loader:
82 // T=2 for bootsect-loader
87 UCHAR LoadFlags
; // flags, unused bits must be zero (RFU)
89 // bit within loadflags,
90 // if set, then the kernel is loaded high
91 // CAN_USE_HEAP = 0x80
92 // if set, the loader also has set heap_end_ptr
93 // to tell how much space behind setup.S
94 // can be used for heap purposes.
95 // Only the loader knows what is free!
97 USHORT SetupMoveSize
; // size to move, when we (setup) are not
98 // loaded at 0x90000. We will move ourselves
99 // to 0x90000 then just before jumping into
100 // the kernel. However, only the loader
101 // know how much of data behind us also needs
104 ULONG Code32Start
; // here loaders can put a different
105 // start address for 32-bit code.
107 // 0x1000 = default for zImage
109 // 0x100000 = default for big kernel
111 ULONG RamdiskAddress
; // address of loaded ramdisk image
112 // Here the loader (or kernel generator) puts
113 // the 32-bit address were it loaded the image.
114 ULONG RamdiskSize
; // its size in bytes
116 USHORT BootSectKludgeOffset
;
117 USHORT BootSectKludgeSegment
;
118 USHORT HeapEnd
; // space from here (exclusive) down to
119 // end of setup code can be used by setup
120 // for local heap purposes.
122 ULONG CommandLinePointer
; // 32-bit pointer to the kernel command line
123 ULONG InitrdAddressMax
; // Highest legal initrd address
126 } LINUX_SETUPSECTOR
, *PLINUX_SETUPSECTOR
;
129 VOID
BootNewLinuxKernel(VOID
); // Implemented in linux.S
130 VOID
BootOldLinuxKernel(ULONG KernelSize
); // Implemented in linux.S
132 VOID
LoadAndBootLinux(PCSTR OperatingSystemName
, PCSTR Description
);
134 BOOLEAN
LinuxParseIniSection(PCSTR OperatingSystemName
);
135 BOOLEAN
LinuxReadBootSector(PFILE LinuxKernelFile
);
136 BOOLEAN
LinuxReadSetupSector(PFILE LinuxKernelFile
);
137 BOOLEAN
LinuxReadKernel(PFILE LinuxKernelFile
);
138 BOOLEAN
LinuxCheckKernelVersion(VOID
);
139 BOOLEAN
LinuxReadInitrd(PFILE LinuxInitrdFile
);
140 #endif /* __i386__ */
142 #endif // defined __LINUX_H