Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux-firmware build system rework #739

Merged
merged 6 commits into from Sep 19, 2016

Conversation

@lrusak
Copy link
Member

commented Sep 15, 2016

This should be tested thoroughly, and it needs to be tested to see if other projects (not Generic) build ok.

This allows us to update the linux-firmware upstream package as a whole more easily, along with the new intel-ucode package. This allows makes it so we don't have to host binary files in our git repo.

@MilhouseVH this will change the way your new script works. Hopefully this is ok.

I have based this on our already included firmware but a couple things should be noted. I am changing the CONFIG_EXTRA_FIRMWARE_DIR to extra-firmware. This is because of this note
https://github.com/torvalds/linux/blob/master/firmware/README.AddingFirmware#L2

Next I am embedding the cpu microcode for amd and intel CPU's into the kernel like we were doing with the GPU firmware. Hopefully this doesn't increase the size too much. maybe @MilhouseVH can do a before and after.

I followed the instructions here, https://github.com/torvalds/linux/blob/master/Documentation/x86/early-microcode.txt#L44-L70

I'm not sure if the package name x86-firmware is the best name, so if someone has something better let me know.

@lrusak

This comment has been minimized.

Copy link
Member Author

commented Sep 15, 2016

Before:

-rw-rw-r-- 1 lukas lukas 12M Sep 15 14:26 build.LibreELEC-Generic.x86_64-8.0-devel/linux-4.7.3/arch/x86/boot/bzImage
-rw-rw-r-- 1 lukas lukas 11846704 Sep 15 14:26 build.LibreELEC-Generic.x86_64-8.0-devel/linux-4.7.3/arch/x86/boot/bzImage

After:

-rw-rw-r-- 1 lukas lukas 13M Sep 15 14:04 build.LibreELEC-Generic.x86_64-8.0-devel/linux-4.7.3/arch/x86/boot/bzImage
-rw-rw-r-- 1 lukas lukas 12648768 Sep 15 14:04 build.LibreELEC-Generic.x86_64-8.0-devel/linux-4.7.3/arch/x86/boot/bzImage

Be aware that this is just the bzImage, not the entire packed cpio.

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Sep 15, 2016

Looks fine, and obsoletes #730, also fine (I'll close it).

However, keeping CONFIG_EXTRA_FIRMWARE in sync with the contents of the x86-firmware and intel-ucode packages is going to be a PITA. Can't this be automated by scanning the firmware directories we're interested in (ie. amd-ucode, intel-ucode, amdgpu, i915, radeon, rtl_nic) and then setting this on linux.x86_64.conf during the build?

@lrusak

This comment has been minimized.

Copy link
Member Author

commented Sep 15, 2016

We could do two things, adjust the script that you wrote in #730 and have it use the build paths for the two packages, or we could have it detect the firmware at runtime.

I'll try doing the ladder for now but I'll see how it goes.

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Sep 15, 2016

I'd rather the latter, it should be quite simple to do and one less thing to forget.

@lrusak

This comment has been minimized.

Copy link
Member Author

commented Sep 15, 2016

I pushed a couple of fixups so that now the firmware list is generated at build time.

Please look over and remind me to squash before merging

@@ -152,6 +152,9 @@ pre_make_target() {

mkdir -p $ROOT/$PKG_BUILD/external-firmware/intel-ucode
cp -a $(get_build_dir intel-ucode)/microcode.bin $ROOT/$PKG_BUILD/external-firmware/intel-ucode

FW_LIST="$(find $ROOT/$PKG_BUILD/external-firmware -type f \( -iname '*.bin' -o -iname '*.fw' \) | sed 's|.*external-firmware/||' | xargs)"

This comment has been minimized.

Copy link
@MilhouseVH

MilhouseVH Sep 15, 2016

Contributor

-type f will miss the 4 firmwares referenced by symbolic links in the i915 directory.

Use \( -type f -o -type l \), or -not -type d will also work.

@lrusak

This comment has been minimized.

Copy link
Member Author

commented Sep 15, 2016

Thanks for pointing that out, I'll fix it
On Thu, Sep 15, 2016 at 4:00 PM MilhouseVH notifications@github.com wrote:

@MilhouseVH commented on this pull request.

In packages/linux/package.mk
#739 (review)
:

@@ -152,6 +152,9 @@ pre_make_target() {

 mkdir -p $ROOT/$PKG_BUILD/external-firmware/intel-ucode
   cp -a $(get_build_dir intel-ucode)/microcode.bin $ROOT/$PKG_BUILD/external-firmware/intel-ucode
  • FW_LIST="$(find $ROOT/$PKG_BUILD/external-firmware -type f ( -iname '.bin' -o -iname '.fw' ) | sed 's|.*external-firmware/||' | xargs)"

-type f will miss the 4 firmwares referenced by symbolic links in the
i915 directory.

Use ( -type f -o -type l ), or -not -type d will also work.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#739 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABiqTMaOr_r4uuCtASBH08dvJkVI3ykPks5qqc4AgaJpZM4J-XnD
.

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2016

I think we should add intel-ucode and x86-firmware packages to LINUX_DEPENDS - that way if we bump either firmware package, the kernel (linux) will always be cleaned and rebuilt.

I've fixed the sym link issue locally, and firmware loading appears to be working as expected (ie. I can see the Skylake NUC loading the i915 GPU firmware) however I don't have any Intel CPUs (i5-6260U and Atom D525) that require microcode updates so I can't verify if this is working or not (it probably is).

It would be an idea (ie. nice) to add a sort to the FW_LIST so that the firmware files are listed in some sort of predictable order - at the moment they're in a somewhat random order.

I've created a gist with all 3 fixes I've mentioned: https://gist.github.com/MilhouseVH/876cbf9e838e0cb60489cbbb424e3efe

@lrusak

This comment has been minimized.

Copy link
Member Author

commented Sep 16, 2016

Thanks for the patch, I have updated it

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2016

Squash & merge?

@lrusak lrusak force-pushed the lrusak:x86-firmware branch from 52c4301 to 03e0a54 Sep 19, 2016

@lrusak

This comment has been minimized.

Copy link
Member Author

commented Sep 19, 2016

Squashed the fixups.

lrusak added 6 commits Sep 19, 2016

@lrusak lrusak force-pushed the lrusak:x86-firmware branch from 03e0a54 to b7f6526 Sep 19, 2016

@MilhouseVH MilhouseVH merged commit 8ae2726 into LibreELEC:master Sep 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.