WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: extract and recompress core.gz  (Read 4255 times)

Offline uekawi

  • Newbie
  • *
  • Posts: 5
extract and recompress core.gz
« on: May 11, 2020, 12:49:54 PM »
Hi guys,

since the wiki on this site is down, can you please tell me, how do i extract and recompress "core.gz"?

When i extract those files, edit stuff, and try to recompress it with: "find | cpio -o -H newc | gzip -2 > core.gz"

i get this message: "cpio: File ./core.gz grew, 524288 new bytes not copied 48622 blocks"

And when i look inside the core.gz archive that was just created, the file inside is of type "unknown" instead of "CPIO archive".

The OS is Ubuntu 20.04 64bit

Thanks

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11621
Re: extract and recompress core.gz
« Reply #1 on: May 11, 2020, 01:05:24 PM »
Hi uekawi
Welcome to the forum.
... since the wiki on this site is down, can you please tell me, how do i extract and recompress "core.gz"? ...

Try this:
To unpack:
Code: [Select]
mkdir tempdir
cd tempdir
zcat /path/to/existing/rootfs.gz | sudo cpio -i

To repack:
Code: [Select]
sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/initrd.gz
Found here:
http://forum.tinycorelinux.net/index.php/topic,22398.msg140327.html#msg140327

An alternative link to the Wiki is:
http://wiki.tinycorelinux.net/doku.php?id=wiki:start
« Last Edit: October 27, 2022, 09:47:01 PM by Rich »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: extract and recompress core.gz
« Reply #2 on: May 11, 2020, 01:11:02 PM »
Your error sounds like you tried to put the new core.gz inside itself.
The only barriers that can stop you are the ones you create yourself.

Offline uekawi

  • Newbie
  • *
  • Posts: 5
Re: extract and recompress core.gz
« Reply #3 on: May 11, 2020, 01:26:12 PM »
Hi uekawi
Welcome to the forum.
... since the wiki on this site is down, can you please tell me, how do i extract and recompress "core.gz"? ...

Try this:
To unpack:
Code: [Select]
mkdir tempdir
cd tempdir
zcat /path/to/existing/rootfs.gz | sudo cpio -i

To repack:
Code: [Select]
sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/initrd.gz
Found here:
http://forum.tinycorelinux.net/index.php/topic,22398.msg140327.html#msg140327

An alternative link to the Wiki is:
http://wiki.tinycorelinux.net/doku.php?id=wiki:start

thanks @rich and @curuga for your quick reply :D

i did exactly what @rich said and ended up with this command: "find . | cpio -o -H newc | gzip > /tmp/test/core.gz" and i was in the dir "/tmp/tempdir" logged in as root (did sudo su at the beginning).

Now i don't get the error message anymore, thank you for that, but the file inside the newly created core.gz file is now of type "program crash data".



thank you in advance for your help :)

EDIT: typo
« Last Edit: October 27, 2022, 09:46:24 PM by Rich »

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11621
Re: extract and recompress core.gz
« Reply #4 on: May 11, 2020, 01:34:51 PM »
Hi uekawi
... Now i don't get the error message anymore, thank you for that, but the file inside the newly created core.gz file is now of type "program crash data". ...
No, it's not. You're file manager is probably just looking at the file name and assuming it's a compressed core dump file.
« Last Edit: May 13, 2020, 08:42:11 AM by Rich »

Offline uekawi

  • Newbie
  • *
  • Posts: 5
Re: extract and recompress core.gz
« Reply #5 on: May 13, 2020, 03:25:49 AM »
Thank you so much guys!

i just managed to get it to work.

It indeed was not broken, but i opened the original and the new core.gz in the same file manager and it displayed in two different ways, so i was a little confused.

But as @Rich pointed out, it didn't matter. I repacked it to the iso and everything except the touch screen went fine!