Support xz compression on yeeloong.
* Makefile.util.def (grub-mkimage): Add $(LIBLZMA). * configure.ac: Check for LZMA. * grub-core/Makefile.core.def (xz_decompress): New target. (none_decompress): Likewise. * grub-core/boot/decompressor/minilib.c: New file. * grub-core/boot/decompressor/none.c: Likewise. * grub-core/boot/decompressor/xz.c: Likewise. * grub-core/kern/mips/cache.S: Change to noreorder nomacro. * grub-core/kern/mips/cache_flush.S: Likewise. * grub-core/kern/i386/pc/lzma_decode.S: Remove dead code. * grub-core/kern/mips/startup.S: Move first stage to ... * grub-core/boot/mips/startup_raw.S: ...here. Change to noreorder nomacro. * grub-core/kern/mips/startup.S: Change to noreorder nomacro. * grub-core/lib/mips/relocator_asm.S: Change to noreorder nomacro. * grub-core/lib/xzembed/xz_dec_bcj.c [GRUB_EMBED_DECOMPRESSOR]: Allocate statically. * grub-core/lib/xzembed/xz_dec_lzma2.c [GRUB_EMBED_DECOMPRESSOR]: Allocate statically or use scratch. Don't check CRC32. * grub-core/lib/xzembed/xz_dec_stream.c [GRUB_EMBED_DECOMPRESSOR]: Allocate statically. Don't check CRC32. * include/grub/decompressor.h: New file. * include/grub/offsets.h (GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE): Removed. (GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE): New field. (GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE): Adjusted. (GRUB_KERNEL_MIPS_YEELOONG_PREFIX): Likewise. (GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END): Likewise. (GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE): New define. * util/grub-mkimage.c (grub_compression_t): New type. (PLATFORM_FLAGS_DECOMPRESSORS): New flag. (image_target_desc): New field default_compression. (image_targets): Adjust yeeloong targets. (compress_kernel_xz) [HAVE_LIBLZMA]: New function. (compress_kernel): New parameter comp. (generate_image): Likewise. Handle new compression case. (options): New option --compression (help): Likewise. (main): Handle new option.
This commit is contained in:
commit
6d0fa83c79
19 changed files with 812 additions and 233 deletions
34
include/grub/decompressor.h
Normal file
34
include/grub/decompressor.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_DECOMPRESSOR_HEADER
|
||||
#define GRUB_DECOMPRESSOR_HEADER 1
|
||||
|
||||
void
|
||||
grub_decompress_core (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize);
|
||||
|
||||
void
|
||||
find_scratch (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize);
|
||||
|
||||
#define GRUB_DECOMPRESSOR_DICT_SIZE (1 << 16)
|
||||
|
||||
extern void *grub_decompressor_scratch;
|
||||
|
||||
#endif
|
|
@ -102,13 +102,12 @@
|
|||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE 0x200
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_SIZE 0x10
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE 0xc
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END 0x54
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
@ -158,6 +157,7 @@
|
|||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _KERNEL_IMAGE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue