zimage.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2002
  4. * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
  5. */
  6. #ifndef _ASM_ZIMAGE_H_
  7. #define _ASM_ZIMAGE_H_
  8. #include <asm/bootparam.h>
  9. #include <asm/e820.h>
  10. /* linux i386 zImage/bzImage header. Offsets relative to
  11. * the start of the image */
  12. #define HEAP_FLAG 0x80
  13. #define BIG_KERNEL_FLAG 0x01
  14. /* magic numbers */
  15. #define KERNEL_MAGIC 0xaa55
  16. #define KERNEL_V2_MAGIC 0x53726448
  17. #define COMMAND_LINE_MAGIC 0xA33F
  18. /* limits */
  19. #define BZIMAGE_MAX_SIZE 15*1024*1024 /* 15MB */
  20. #define ZIMAGE_MAX_SIZE 512*1024 /* 512k */
  21. #define SETUP_MAX_SIZE 32768
  22. #define SETUP_START_OFFSET 0x200
  23. #define BZIMAGE_LOAD_ADDR 0x100000
  24. #define ZIMAGE_LOAD_ADDR 0x10000
  25. /**
  26. * load_zimage() - Load a zImage or bzImage
  27. *
  28. * This copies an image into the standard location ready for setup
  29. *
  30. * @image: Address of image to load
  31. * @kernel_size: Size of kernel including setup block (or 0 if the kernel is
  32. * new enough to have a 'syssize' value)
  33. * @load_addressp: Returns the address where the kernel has been loaded
  34. * @return address of setup block, or NULL if something went wrong
  35. */
  36. struct boot_params *load_zimage(char *image, unsigned long kernel_size,
  37. ulong *load_addressp);
  38. /**
  39. * setup_zimage() - Set up a loaded zImage or bzImage ready for booting
  40. *
  41. * @setup_base: Pointer to the boot parameters, typically at address
  42. * DEFAULT_SETUP_BASE
  43. * @cmd_line: Place to put the command line, or NULL to use the one in the setup
  44. * block
  45. * @initrd_addr: Address of the initial ramdisk, or 0 if none
  46. * @initrd_size: Size of the initial ramdisk, or 0 if none
  47. * @load_address: Address where the bzImage is moved before booting, either
  48. * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
  49. * @cmdline_force: Address of 'override' command line, or 0 to use the one in
  50. * the * setup block
  51. * @return 0 (always)
  52. */
  53. int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
  54. ulong initrd_addr, ulong initrd_size, ulong cmdline_force);
  55. /**
  56. * zimage_dump() - Dump the metadata of a zimage
  57. *
  58. * This shows all available information in a zimage that has been loaded.
  59. *
  60. * @base_ptr: Pointer to the boot parameters, typically at address
  61. * DEFAULT_SETUP_BASE
  62. */
  63. void zimage_dump(struct boot_params *base_ptr);
  64. void setup_video(struct screen_info *screen_info);
  65. void setup_efi_info(struct efi_info *efi_info);
  66. #endif