Skip to content

Commit

Permalink
initrd: make sure ustar is generated
Browse files Browse the repository at this point in the history
Also fix initrd detection code

Signed-off-by: Peter Shkenev <[email protected]>
  • Loading branch information
petershh authored and heatd committed May 13, 2024
1 parent 58c7b5e commit 1a1561b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions kernel/kernel/initrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
bool is_tar(void *initrd)
{
tar_header_t *header = (tar_header_t *) initrd;
return !memcmp(header->magic, "ustar ", 6);
return !memcmp(header->magic, "ustar ", 5);
}

unsigned int parse_perms_from_tar(tar_header_t *entry)
Expand All @@ -42,7 +42,7 @@ unsigned int parse_perms_from_tar(tar_header_t *entry)
void tar_handle_entry(tar_header_t *entry, onx::stream &str)
{
char *saveptr;
if (memcmp(entry->magic, "ustar ", 6))
if (memcmp(entry->magic, "ustar ", 5))
panic("Tar entry with invalid magic value");
auto len = strnlen(entry->filename, 100);

Expand Down
2 changes: 1 addition & 1 deletion scripts/geninitrd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ echo "Creating a tarball"
# Tar it up
cd initrd-root

tar cvf initrd.tar *
tar --format=ustar -cvf initrd.tar *

mv initrd.tar ..
cd ..
Expand Down

0 comments on commit 1a1561b

Please sign in to comment.