Jump to content
dlandon

How to unzip and zip bzroot

17 posts in this topic Last Reply

Recommended Posts

Can someone give me the method of unzipping bzroot and then zipping it back?  I want to make some adjustments and save the changes for testing.

Share this post


Link to post

I'm not an expert on this, but you might be able to use the part titled "Create new bzroot and copy both bzimage and bzroot to USB flash" from this page on the wiki http://lime-technology.com/wiki/index.php/Building_a_custom_kernel

 

mkdir /mnt/dev/bz-mod
cd /mnt/dev/bz-mod
installpkg /boot/packages/cpio-2.9-i486-2.txz
xzcat ../bzroot | cpio -m -i -d -H newc --no-absolute-filenames
rsync -av --delete /lib/modules/3.9.11p-unRAID/ lib/modules/3.9.11p-unRAID/

#Here's where I add firmware for my hardware
cp /boot/packages/dvb-usb-af9015.fw lib/firmware/

find . | cpio -o -H newc | xz --check=crc32 --x86 --lzma2=preset=9e > /boot/bzroot_new
#Copy bzimage_new
cp arch/x86/boot/bzImage /boot/bzimage_new

 

I had to modify it a little bit when I built my new kernel, but I do not remember what I did and did not document it  ::)

But from what I remember I made a new folder on the cache disk to unpack and pack the bzroot again or else my memory would run out.

 

Hope this helps a little :)

Share this post


Link to post

I think that applies to v5 and not v6.  I believe the packing/zipping mechanism has changed along the way in v6.

Share this post


Link to post

I think that applies to v5 and not v6.  I believe the packing/zipping mechanism has changed along the way in v6.

 

cpio works fine for v6. I did that to check out the updates before being able to install them on my server. The only difference if there ever was any would be in what compression level it uses.

Share this post


Link to post

I think that applies to v5 and not v6.  I believe the packing/zipping mechanism has changed along the way in v6.

 

cpio works fine for v6. I did that to check out the updates before being able to install them on my server. The only difference if there ever was any would be in what compression level it uses.

 

Ok.  I'll give it a go.

Share this post


Link to post

It worked.  I just had to use the 64bit cpio package.

 

installpkg /boot/packages/cpio-2.11-x86_64-2.txz

Share this post


Link to post

I forgot to say that I did this with version 6, and I figured you would use the 64bit version of cpio  ;)

Share this post


Link to post

It worked.  I just had to use the 64bit cpio package.

 

installpkg /boot/packages/cpio-2.11-x86_64-2.txz

 

It's also a part of the NerdPack plugin.

Share this post


Link to post

I wanted to do this too but I'm running into some issues.. and all the documentation for this is out of date at this point.  It looks like bzroot is just a straight cpio archive so no need to use xzcat before the extract.. problem is the only thing in there is kernel/x86/microcode/AuthenticAMD.bin and kernel/x86/microcode/GenuineIntel.bin

 

I'm not sure why those two files are the only things extracting.. I'm not getting any errors from cpio but it's only extracting 3468 blocks.

Share this post


Link to post

The lines dealing with extraction, since bzroot has 2 sections you need to deal with first part and then skip that section to get to the last part:

 


echo -e " ----- Extract BZROOT microcode"

dd if=/boot/bzroot bs=512 count=$(cpio -ivt -H newc < /boot/bzroot 2>&1 > /dev/null | awk '{print $1}') of=bzrootmicrocode

 

echo -e "----- Unpack BZROOT"

dd if=/boot/bzroot bs=512 skip=$(cpio -ivt -H newc < /boot/bzroot 2>&1 > /dev/null | awk '{print $1}') | xzcat | cpio -i -d -H newc --no-absolute-filenames

Share this post


Link to post
Posted (edited)
On 1/20/2019 at 2:50 PM, BRiT said:

The lines dealing with extraction, since bzroot has 2 sections you need to deal with first part and then skip that section to get to the last part:

 

 


echo -e " ----- Extract BZROOT microcode"

dd if=/boot/bzroot bs=512 count=$(cpio -ivt -H newc < /boot/bzroot 2>&1 > /dev/null | awk '{print $1}') of=bzrootmicrocode

 

echo -e "----- Unpack BZROOT"

dd if=/boot/bzroot bs=512 skip=$(cpio -ivt -H newc < /boot/bzroot 2>&1 > /dev/null | awk '{print $1}') | xzcat | cpio -i -d -H newc --no-absolute-filenames

 

Thank you very much, can you please explain how to put things together?

First command extracts kernel folder with intel/amd microcodes in a cpio archive named microcode, second command extract all the system folders/files.

 

Once changes are applied, how to recreate the cpio bzroot archive?

 

Thank you

 

Update: solved!

Just extract the kernel folder into the folder with the system files, then compress the new bzroot with this command:

 

find . ! -name bzroot | cpio -o -H newc | xz --check=crc32 --x86 --lzma2=preset=9e > /folder-to-bzroot/bzroot

 

lzma2 compression is ok.

Edited by ghost82
Solved

Share this post


Link to post
On 1/20/2019 at 7:11 AM, saarg said:

Hey @CHBMB Does the code that use to live here still exist somewhere as reference?  I see that this code is gone and now there are linuxserver unraid plugins that exists with prebuilt archives.  This is nice/convenient for a lot of unraid users but removing the source used to create the archives and making users trust the prebuilt archives is kind of a shame.  It was useful to refer to those scripts when I was making changes of my own (I wouldn't have been able to figure out how to unpackage & modify these bz files on my own).  Is there a reason the source scripts for these aren't included along with the plugin or perhaps elsewhere? (I'm specifically referring to these two projects Unraid-DVB-Plugin and Unraid-Nvidia-Plugin)

Share this post


Link to post
25 minutes ago, jkluch said:

Hey @CHBMB Does the code that use to live here still exist somewhere as reference?  I see that this code is gone and now there are linuxserver unraid plugins that exists with prebuilt archives.  This is nice/convenient for a lot of unraid users but removing the source used to create the archives and making users trust the prebuilt archives is kind of a shame.  It was useful to refer to those scripts when I was making changes of my own (I wouldn't have been able to figure out how to unpackage & modify these bz files on my own).  Is there a reason the source scripts for these aren't included along with the plugin or perhaps elsewhere? (I'm specifically referring to these two projects Unraid-DVB-Plugin and Unraid-Nvidia-Plugin)

The DVB source scripts are here.  https://github.com/linuxserver/Unraid-DVB

 

The Nvidia source scripts we deliberately are keeping closed as we're a tiny bit scared of Nvidia and the possibility of people using them to circumvent certain Nvidia restrictions.

Share this post


Link to post

Here's how to uncompress/compress bzroot

 

 ##Extract microcode

dd if=$D/unraid/bzroot bs=512 count=$(cpio -ivt -H newc < $D/unraid/bzroot 2>&1 > /dev/null | awk '{print $1}') of=$D/unraid/bzmicrocode

##Unpack

dd if=$D/unraid/bzroot bs=512 skip=$(cpio -ivt -H newc < $D/unraid/bzroot 2>&1 > /dev/null | awk '{print $1}') | xzcat | cpio -i -d -H newc --no-absolute-filenames

##Prepend microcode and Compress

cp $D/unraid/bzmicrocode $D/$VERSION/nvidia/bzroot

find . | cpio -o -H newc | xz --format=lzma >> $D/$VERSION/nvidia/bzroot 

 

  • Like 1
  • Upvote 1

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.