Project

General

Profile

Packaging Request #3304

Bug #3334: Make aarch64-linux-gnu-gcc work again on armv7h

linux-libre-64 5.18.5

avalos - almost 2 years ago - . Updated over 1 year ago.

Status:
open
Priority:
wish
Assignee:
% Done:

0%


Description

Hello! I managed to build version 5.18.5 of linux-libre-64. I started from linux-libre instead of linux-libre-64 because patches were already reworked for 5.18.2. Then I merged most of linux-libre-64's PKGBUILD into it. I can't guarantee it is entirely and correctly deblobbed, so you should check it before anything.

The patches from Arch Linux ARM (armv7h) were included in the latest linux-libre-64. I suspect they aren't necessary because they improve support for armv7h boards, and, well, we're running linux-libre-64 on aarch64 hardware, so we can remove them. I included two patches from Arch Linux ARM (aarch64), one that fixes a RK3399 issue.


Files

History

#1

Updated by bill-auger almost 2 years ago

  • Assignee set to GNUtoo

so the patch was made against libre/linux-libre, not libre/linux-libre-64?

just to understand the implication, that means it will not apply to libre/linux-libre-64 - to add the changes to abslibre, someone must first apply it to libre/linux-libre, then copy the files from libre/linux-libre/* to libre/linux-libre-64/, and then make a new patch from that

i also noticed a WIP branch of abslibre GNUtoo/linux-libre-64-wip; so maybe it should be rebased onto that instead

#2

Updated by bill-auger almost 2 years ago

i merged this patch into abslibre - it is on the 'wip-linux-libre-64' branch

#3

Updated by avalos almost 2 years ago

That's not correct. The changes were initially made against linux-libre, merging in most of linux-libre-64. At the end of the process, the patch was generated relative to linux-libre-64, not linux-libre. This was possible because linux-libre-64 is basically linux-libre with few changes to cross-compile for aarch64.

#4

Updated by avalos almost 2 years ago

  • File 0001-Updated-linux-libre-64-to-5.18.5-based-on-latest-lin.patch added

So, the original patch was a huge mess. Here is a better patch, in case you still need it.

#5

Updated by bill-auger almost 2 years ago

  • File deleted (0001-Updated-linux-libre-64-to-5.18.5.patch)
#6

Updated by bill-auger almost 2 years ago

  • File deleted (0001-Updated-linux-libre-64-to-5.18.5-based-on-latest-lin.patch)
#7

Updated by bill-auger almost 2 years ago

we discussed this a bit on IRC - this PKGBUILD is quite confusing; but it was before these changes - it appears to have been intended to be built only in an armv7h environment

source_armv7h+=(config.aarch64)
....
  armv7h) KARCH=arm64;CROSS_COMPILE=aarch64-linux-gnu-;;
....
  armv7h) cp ../config.aarch64 .config;echo 'CONFIG_COMPAT=y' >> .config;;

all three of the above are done only if CARCH is armv7h - but the GCC cross-compiler dependency does not exist

# makedepends_armv7h+=('aarch64-linux-gnu-gcc-initial') # FIXME: no such package

there is a 'aarch64-linux-gnu-gcc' package for x86_64 and i686; but there is neither for armv7h - this PKGBUILD is rather confusing - it removes x86_64 from the arch=() array; and if $CARCH is i686, 'x86_64-pc-linux-gnu-gcc' is imported, but not 'aarch64-linux-gnu-gcc', and KARCH is set to x86 - i do see that there are two 'lnux-libre-64' packages in the repos now, one in armv7h and one in i686; but i dunno how either of them came out of this PKBUILD - im sure GNUtoo can clarify this

makedepends_i686+=('x86_64-pc-linux-gnu-gcc')
....
  i686) KARCH=x86;CROSS_COMPILE=x86_64-pc-linux-gnu-;;

in any case, it currently fails to build with libretools, which is a requisite before publishing it - can you tell me, how did you compile this PKGBUILD?

#8

Updated by avalos almost 2 years ago

I built the PKGBUILD (in my x86_64 PC) like this:

export CARCH=armv7h
makepkg -s

Also, the armv7h patches are probably not necessary, as we won't be running linux-libre-64 in armv7h boards. We should remove them. The patches are also present in linux-libre, and as we know, linux-libre-64 PKGBUILD is a modified copy of the linux-libre one, so maybe GNUtoo didn't remove the armv7h patches already present. We only need the two aarch64 patches from Arch Linux ARM.

#9

Updated by bill-auger almost 2 years ago

thats kinda a hack - did it work? - i mean can you boot that kernel?

Also, the armv7h patches are probably not necessary,

not necessary, and probably wrong for the aarch64 kernel

i suppose that the reason they are there, is to minimize the diff against the linux-libre PKGBUILD - i re-worked it to allow only cross-compiling from x86_64 (ie: CARCH=armv7h would not be needed); and i commented it thoroughly to reduce the confusion

the archarm kernel uses all of the arch patches; and the x86_64 build of linux-libre does not have any special per-arch treatments; so i over-rode the per-arch mechanism for x86_64, to further minimize the diff - if it works, then the PKGBUILD should be identical to the linux-libre PKGBUILD, except for those special lines, which are clearly commented as special over-rides

#10

Updated by avalos almost 2 years ago

bill-auger wrote:

thats kinda a hack - did it work? - i mean can you boot that kernel?

The particular thing about linux-libre-64 is that when you ask it to build for arm7h, it actually builds for aarch64. Check the `case` statements. Since Parabola has no aarch64 support, it must disguise as an armv7h package built (from Parabola's perspective) for armv7h.

i suppose that the reason they are there, is to minimize the diff against the linux-libre PKGBUILD

Sounds like a logical explanation.

- i re-worked it to allow only cross-compiling from x86_64 (ie: CARCH=armv7h would not be needed); and i commented it thoroughly to reduce the confusion

Parabola builds are manual, right? If so, then this shouldn't cause any problem, I guess.

the archarm kernel uses all of the arch patches; and the x86_64 build of linux-libre does not have any special per-arch treatments; so i over-rode the per-arch mechanism for x86_64, to further minimize the diff - if it works, then the PKGBUILD should be identical to the linux-libre PKGBUILD, except for those special lines, which are clearly commented as special over-rides

I'll check the changes you did.

#11

Updated by bill-auger almost 2 years ago

ok the package compiled that way - the problem though, is that it is an x86_64 package - im not sure if i can trick it into the armv7h repo

avalos - do you remember, did your package filename have armv7h in it, or x86_64 ?

Parabola builds are manual, right? If so, then this shouldn't cause any problem,

only the one i mentioned - it may be best to put the over-rides i have now, on armv7h instead; but that would require a 'aarch64-linux-gnu-gcc' package for armv7h, which was the original problem

#12

Updated by bill-auger almost 2 years ago

i just published the binary package to x86_64/libre-testing, if someone wants to try it - you would need to cherry pick the files, obviously - i dont have hardware to test it on

https://repo.parabola.nu/pool/parabola/linux-libre-64-5.18.5-1-x86_64.pkg.tar.zst
https://repo.parabola.nu/pool/parabola/linux-libre-64-5.18.5-1-x86_64.pkg.tar.zst.sig

#14

Updated by avalos almost 2 years ago

Is this expected output of the mkinitcpio command? By the way, I fixed the installation of the preset file in the patch from the last attachment.

==> WARNING: No modules were added to the image. This is probably not what you want.
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-libre-64.img
==> WARNING: errors were encountered during the build. The image may not be complete.
#17

Updated by bill-auger almost 2 years ago

  • Priority changed from bug to wish

i was able to build linux-libre-64 5.18.5 for armv7h with the bootstrap cross-compiler aarch64-linux-gnu-gcc-initial 9.3.0-1parabola1

this and all the cross-compiler packages are in armv7h/libre-testing now

linux-libre-64                            5.18.5
aarch64-linux-gnu-gcc-initial             9.3.0-1parabola1
aarch64-linux-gnu-binutils                2.38-1
aarch64-linux-gnu-glibc                   2.35-1
aarch64-linux-gnu-linux-libre-api-headers 5.18_gnu-1
#18

Updated by avalos over 1 year ago

In order for the battery gauge in the Pinebook Pro to work, we need to enable the option CONFIG_BATTERY_CW2015 to the kernel configuration, so the driver is loaded. Thanks for the solution, GNUtoo!

#19

Updated by bill-auger over 1 year ago

  • Assignee changed from GNUtoo to bill-auger

the battery monitor patch is on the tip of the wip-linux-libre-64 now

#20

Updated by bill-auger over 1 year ago

UPDATE: avalos built this for armv7h; but it would not boot - it was successful (again) by cross-compiling from x86_64 - this time however, avalos put CARCH=armv7h into the PKGBUILD; which created a package which the armv7h pacman would accept

i just noticed a bug in the PKGBUILD though, which (maybe?) should be corrected - that PKGUILD did not apply any of the armv7h patches, only the aarch64 patches

roughly, because of this trick:

source_armv7h=(
  # Arch Linux ARM patches (armv7h)
  ...
)
source_aarch64=(
  # Arch Linux ARM patches (aarch64)
  ....
)
source_armv7h=( ${source_aarch64[*]} ) # cross-compile over-ride

that final LOC (probably) should have been appending:
source_armv7h+=( ${source_aarch64[*]} ) # cross-compile over-ride

#21

Updated by bill-auger over 1 year ago

  • Parent task set to #3334

Also available in: Atom PDF