[boot] More initrd format changes

CDB seemed to be too simple for the needs of init, and squashfs is too
laden with design choices to work around Linux's APIs. This commit adds
creation of an initrd image of a new format I've called `j6romfs`.

Note that this commit currently does not work! The initrd-reading code
still needs to be added.
This commit is contained in:
Justin C. Miller
2023-01-29 19:10:12 -08:00
parent 1f15d2ef49
commit 6f7dd7fc05
9 changed files with 276 additions and 79 deletions

17
scripts/fnv.py Normal file
View File

@@ -0,0 +1,17 @@
"""Python implementation of FNV hashes."""
_FNV1_prime32 = 16777619
_FNV1_prime64 = 1099511628211
_FNV1_offset32 = 2166136261
_FNV1_offset64 = 14695981039346656037
def _fnv1a(offset, prime, mask):
def hashfunc(data):
h = offset
for b in data:
h = ((h ^ b) * prime) & mask
return h
return hashfunc
hash64 = _fnv1a(_FNV1_offset64, _FNV1_prime64, (2**64)-1)
hash32 = _fnv1a(_FNV1_offset32, _FNV1_prime32, (2**32)-1)