Use decompressors framework on i386-pc. It increases core size

by 46 bytes but improves compatibility and maintainability.

	* grub-core/Makefile.core.def (lzma_decompress): New image.
	(kernel): Add i386_pc_ldflags.
	* grub-core/kern/i386/pc/startup.S: Move intial part to ..
	* grub-core/boot/i386/pc/startup_raw.S: ... here. Pass pointers
	to real_to_prot, prot_to_real and device info.
	* include/grub/offsets.h: Renamed decompressor offsets.
	* util/grub-mkimage.c (grub_compression_t): New cmpression lzma.
	(image_target_desc): Remove raw_size and rename decompressor fields.
	(compress_kernel): Handle lzma.
	(generate_image): Handle decompressors on i386-pc.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-11-12 19:53:25 +01:00
parent e9d3421c05
commit 60240b8bc1
12 changed files with 601 additions and 486 deletions

View file

@ -19,11 +19,11 @@
#ifndef OFFSETS_HEADER
#define OFFSETS_HEADER 1
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE 0x8
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_DECOMPRESSOR_I386_PC_COMPRESSED_SIZE 0x08
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_KERNEL_I386_PC_COMPRESSED_SIZE 0x0c
#define GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE 0x0c
/* The offset of GRUB_INSTALL_DOS_PART. */
#define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x10
@ -34,15 +34,12 @@
/* Offset of reed_solomon_redundancy. */
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x18
/* The size of the first region which won't be compressed. */
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xc70
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x6e0
/* The segment where the kernel is loaded. */
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x8200
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000
/* The upper memory area (starting at 640 kiB). */
#define GRUB_MEMORY_I386_PC_UPPER 0xa0000
@ -62,7 +59,6 @@
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
#define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
@ -133,10 +129,12 @@
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _RAW_SIZE)
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_BSD_PART)
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_DOS_PART)
#define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
#define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
#define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
#endif
#ifndef ASM_FILE