initramfs buffer spec -- second draft
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · H. Peter Anvin
Field name Field size Meaning
c_magic6 bytes The string "070701" or "070702"c_ino8 bytes File inode numberc_mode8 bytes File mode and permissionsc_uid8 bytes File uidc_gid8 bytes File gidc_nlink 8 bytes Number of links c_mtime 8 bytes Modification time c_filesize 8 bytes Size of data field
Quoted 6 lines
c_maj8 bytes Major part of file device numberc_min8 bytes Minor part of file device numberc_rmaj8 bytes Major part of device node referencec_rmin8 bytes Minor part of device node referencec_namesize8 bytes Length of filename, including final \0c_chksum8 bytes CRC of data field ifc_magicis 070702
+ or "00000000" if it's 070701. Kernel
+ is not expected to verify it in any case.
Quoted 2 lines
The
c_modefield matches the contents ofst_modereturned by stat(2) on Linux, and encodes the file type and file permissions.
- The c_filesize should be zero for any non-regular file.
+ The c_filesize can be non-zero only for regular files and symlinks.
+ For symlinks data and c_filesize match the results of readlink(2).
+ Having more than one link to a symlink is illegal.
Review
Quoted 4 lines · Alexander Viro
Quoted 1 line
(quoted diff) +2
-0+ or "00000000" if it's 070701. Kernel + is not expected to verify it in any case.
Check.
Quoted 6 lines
- The
c_filesizeshould be zero for any non-regular file.
+ Thec_filesizecan be non-zero only for regular files and symlinks.
+ For symlinks data andc_filesizematch the results of readlink(2).
+ Having more than one link to a symlink is illegal.
Why can't you have more than one link to a symlink?
-hpa
Quoted 7 lines · H. Peter Anvin
Quoted 5 lines
- The
c_filesizeshould be zero for any non-regular file.
+ Thec_filesizecan be non-zero only for regular files and symlinks.
+ For symlinks data andc_filesizematch the results of readlink(2).
+ Having more than one link to a symlink is illegal.Why can't you have more than one link to a symlink?
Basically, you'll have no decent way to preserve that when you unpack.
In our case we _can_ do that; in general there is no portable way to create such links (semantics of link(2) wrt following links differs even between Linux versions, let alone various Unices).
cpio(1) includes the symlink body with each instance and doesn't even bother trying to link(2) them when unpacking.
Review
Quoted 6 lines · Alexander Viro
Quoted 1 line · H. Peter Anvin
c_chksum8 bytes CRC of data field ifc_magicis 070702(quoted diff) +2
-0+ or "00000000" if it's 070701. Kernel + is not expected to verify it in any case.
Why is the kernel not expected to check the data integrity? Usually end to end data integrity is important. And a check on the data integrity and tells us that either the bootloader or the hardware is messed up can save hours of debugging?
Eric