Electron752
Posts: 142
Joined: Mon Mar 02, 2015 7:09 pm

Experimental 64 bit kernel in foundation github tree

Thu Aug 25, 2016 12:37 am

I just wanted to let everyone know that a 64 bit kernel has been checked into the foundation github tree. Only source is available at this time so you will need to compile it yourself. Since this is very experimental, DO NOT BOTHER ANY OF THE FOUNDATION DEVELOPERS. PM ME OR POST HERE!

You will need to install the 64bit cross compilers to build the tree. I do this from a 64 bit chroot on a linux pc.

1. Get the source
git https://www.github.com/raspberrypi/linux linux-rpi
cd linux-rpi
git checkout rpi-4.8.y

2. Build it
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 bcmrpi3_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 modules_install

This installs the modules in the /lib/modules directory of the chroot.

3. Install it - Assuming the RPI 3 media is mounted at /mnt and /mnt/boot
cp arch/arm64/boot/Image /mnt/boot/kernel8.img
cp arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb /mnt/boot
cp -rv /lib/modules/* /mnt/lib/modules/

If you have a relatively new version of the firmware, no config.txt changes should be needed. It may be necessary to delete the other *.img and vmlinuz images. Of course, if you are using a custom kernel or initrd that will need to changed or removed. For more advance features, it is recommended to use u-boot instead of having the firmware load the kernel directly.

In my testing, I was able to get the open source 3d driver driver to work but it requires a patched version of mesa and potentially manual merging of the device tree overlay.

Known Issues:
1. VCHIQ and HDMI audio are not included at this time.
2. PI Foundation touchscreen does not work correctly.

Monery
Posts: 4
Joined: Wed May 25, 2016 8:36 am

Re: Experimental 64 bit kernel in foundation github tree

Tue Nov 29, 2016 1:13 am

You will need to install the 64bit cross compilers to build the tree...
You used "The". Is there a special compilier to do this? If so where can I get it from

aBradleyUno
Posts: 2
Joined: Sun Dec 11, 2016 12:46 pm

Re: Experimental 64 bit kernel in foundation github tree

Sun Dec 11, 2016 12:50 pm

Sorry for the inconvenience but, I've been trying to compile the kernel and I can't get the wifi and bluetooth to work, can you help me with that?

User avatar
Penthux
Posts: 79
Joined: Thu Oct 11, 2012 7:33 am
Location: United Kingdom

Re: Experimental 64 bit kernel in foundation github tree

Sun Dec 18, 2016 8:15 pm

@Electron752 - Isn't it better to cross-compile aarch64 natively on the RPi3, using the same architecture on which to build that you're intending to run it on? The same goes for cross-compiling packages because many ARM packages aren't suitable for cross-compilation without making many laborious, and pain-staking, manual adjustments to Makefiles. Plus, if your packages are linking against system libraries, to get them working properly in a cross-compiler environment can be quite a convoluted and problematic process.

And shouldn't building the kernel/modules/DTB process be a little more like this... ?

Code: Select all

make -j4 ARCH=arm64 CROSS_COMPILE=aarch64-linux- bcmrpi3_defconfig
make -j4 ARCH=arm64 CROSS_COMPILE=aarch64-linux- LOCALVERSION="-arm64" Image
make -j4 ARCH=arm64 CROSS_COMPILE=aarch64-linux- LOCALVERSION="-arm64" dtbs
make -j4 ARCH=arm64 CROSS_COMPILE=aarch64-linux- LOCALVERSION="-arm64" modules
make -j4 ARCH=arm64 CROSS_COMPILE=aarch64-linux- modules_install
This method seems to work perfectly for me on Slackware ARM.
Penthux
------------
Slackware ARM on a Raspberry Pi - SARPi
http://sarpi.co.uk
"Slackware ARM - it's not for NOOBS!"

User avatar
Penthux
Posts: 79
Joined: Thu Oct 11, 2012 7:33 am
Location: United Kingdom

Re: Experimental 64 bit kernel in foundation github tree

Sun Dec 18, 2016 8:16 pm

Monery wrote:
You will need to install the 64bit cross compilers to build the tree...
You used "The". Is there a special compilier to do this? If so where can I get it from
http://docs.slackware.com/howtos:hardwa ... s-compiler ;)
Penthux
------------
Slackware ARM on a Raspberry Pi - SARPi
http://sarpi.co.uk
"Slackware ARM - it's not for NOOBS!"

NinjaSamurai
Posts: 5
Joined: Wed Feb 01, 2017 9:35 am

Re: Experimental 64 bit kernel in foundation github tree

Wed Feb 01, 2017 9:51 am

Hi! Great work regarding the 64bit implementation.

I was wondering: Does anyone have a simple list of the relevant commits that make the kernel 64bit compatible on the RPi3?

I haven't seen a single patch set; there've been several repositories spread out all over the web, with half of the links pointing to those being broken (since the repos have been fully deleted) or otherwise, the repos that exist, have been abandoned at a stage where things were half-working. After that, everything else only points to upstream foundation-repos, constantly chasing whatever Linux version is the latest during that given week.

So at least I haven't been able to find any compact, simple overview of the commits that make up the current 64bit RPi3 implementation. Or any patch set containing those.

Is there anyone who does know the exact changes that have been made for 64bit compatibility? My motivation is that I do not want to use the latest and greatest kernel, but the current LTS default for the RPi (which is still 4.4, even though they are moving to 4.9 soon), so I would rather patch the relevant bits into the 4.4 kernel and backport some of the modifications - if necessary. But right now, it seems impossible since everyone just points to the latest 4.9/4.10 upstream kernels, when talking about building a 64bit kernel, while the only focus seems to be on the kernel config.

Thanks a lot!

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: Experimental 64 bit kernel in foundation github tree

Wed Feb 01, 2017 3:34 pm

I don't think I've seen a single patch set you could use.

I've made various things work by checking commits to the 4.9 and 4.10 branches and manually merging them in as needed. It's not exactly quick or easy in some cases. Depending on the features you are looking for, you may end up with a bit of a frankenstein 4.4/4.9/4.10 kernel.

Here is a thread with more information -- viewtopic.php?f=71&t=156557&p=1106351#p1106351.

Check out mm7's work linked from that thread for a 4.4 64-bit kernel. I haven't tried it myself, but I've used some of the code to help my own efforts. With a bit of effort you could probably make a collection of his commits into your own patch set.

My repo is based on the 4.9 branch+rough touchscreen support+more

NinjaSamurai
Posts: 5
Joined: Wed Feb 01, 2017 9:35 am

Re: Experimental 64 bit kernel in foundation github tree

Wed Feb 01, 2017 3:40 pm

Thanks a lot for your input! I'll definitely check out the thread you have linked.

So it seems you went through a similar process of trying to find out what needs to get in to make it work. If there was an overview of the exact files that needed to be modified, then it should be possible to dig through the commit history and see what exactly has been done. I am quite sure that 90% of it is kernel version-independent, so that the majority of the changes should be the same for, say a 4.4 or a 4.8 kernel.

Just wishing that this was documented somewhere. If anyone else here knows more, please share :)

Thanks again @ktb

NinjaSamurai
Posts: 5
Joined: Wed Feb 01, 2017 9:35 am

Re: Experimental 64 bit kernel in foundation github tree

Wed Feb 01, 2017 9:03 pm

I just saw that drivers/misc/vc04_services (vchiq, etc.) has been moved to drivers/staging/vc04_services from 4.9 onwards - since it had been added upstream. A lot of the 64bit work went into that - and the only commits I can find are for >= 4.9, which is highly irritating. Does anyone have an idea regarding how to handle this, if the goal is to get those changes into 4.4 when it was still in a totally different location with an earlier version and structure?

@ktb: I've seen the two all-in-one patches on top of your Github repo - that looks like really good work. But I was also able to verify that the sources (4.9) they have been applied to, already contain some 64bit work which is part of the standard Pi Foundation 4.9 kernel. If somebody is cloning your repo, then that'll be me, no cause for concern ;)

As far as I can see it, the biggest obstacle is that vchiq has been changed and moved to staging (I don't even build any staging drivers in my kernels and always turn CONFIG_STAGING off completely - which could obviously be changed; but as I said, in the 4.4 kernel for which I want to build this, it is still all in drivers/misc )

Any advice or suggestions on how to approach backporting this stuff is highly appreciated ;)

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: Experimental 64 bit kernel in foundation github tree

Thu Feb 02, 2017 7:40 am

I would probably try to move it to staging myself in the 4.4 kernel if I were trying to make that work. I'd probably end up with a 4.4/4.9/4.10 hybrid kernel in the end.

From what I gather, I don't think there is any plan to backport that upstreamed VCHIQ stuff to 4.4. I think the RPF intends to move to 4.9 in the near future and they aren't concerned about getting all the upstream VCHIQ work into older kernels. Personally, I have very little interest in seeing these things work on 4.4.

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: Experimental 64 bit kernel in foundation github tree

Thu Feb 02, 2017 2:29 pm

The neatest thing I've tried so far is weston-launch from tty1 with HDMI and DSI connected as well as analogue audio out. This gets me a dual screen config (extended displays).

NinjaSamurai
Posts: 5
Joined: Wed Feb 01, 2017 9:35 am

Re: Experimental 64 bit kernel in foundation github tree

Tue Apr 18, 2017 11:25 pm

Hi again. Since 4.9 has now been the RPi Foundation's default kernel version for a while, I'm wondering what the status of 64bit operation of this LTS kernel version is:

Can we build a working 64bit kernel without modifications from the Foundation's 4.9 repo now? Including vchiq/VC4?

I am now willing to give up my original plan of hacking 4.4 to get proper 64bit support and would happily move over to 4.9 instead, but I want to avoid any non-LTS kernel for a variety of obvious reasons.

Thanks for all your input so far guys!

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 53 guests