rootfs.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. /* Rootfs image format (see mkrootfs.c).
  2. *
  3. * The command pack is the system rootfs: a gzip-compressed NBPAK1 pack with
  4. * a one-sector header, so the boot loader can find its length and checksum
  5. * without a filesystem. The header is sector 0 of the image (or of the
  6. * rootfs partition); the pack starts at byte 512.
  7. *
  8. * 0 char magic[8] "NBROOT1\0"
  9. * 8 u32 version
  10. * 12 u32 pack_bytes exact gzip length (the ISIZE trailer matters)
  11. * 16 u32 pack_csum sum of the pack bytes, mod 2^32
  12. * 20 u32 flags ROOTFS_FLAG_GZIP
  13. * ... zero padding to 512
  14. */
  15. #ifndef ROOTFS_H
  16. #define ROOTFS_H
  17. #define ROOTFS_MAGIC "NBROOT1"
  18. #define ROOTFS_VERSION 1u
  19. #define ROOTFS_FLAG_GZIP 0x00000001u
  20. #define ROOTFS_HDR_SIZE 512u
  21. #define ROOTFS_PACK_OFFSET 512u
  22. struct rootfs_hdr {
  23. char magic[8];
  24. unsigned int version;
  25. unsigned int pack_bytes;
  26. unsigned int pack_csum;
  27. unsigned int flags;
  28. unsigned int reserved[(ROOTFS_HDR_SIZE - 24) / 4];
  29. } __attribute__((packed));
  30. #endif