User avatar
sakaki
Posts: 381
Joined: Sun Jul 16, 2017 1:11 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Wed Aug 14, 2019 1:01 am

cjan wrote:
Wed Aug 14, 2019 12:56 am
'With the tweaked mesa' what does it mean? recompile or patch?
You just need to turn on the v3d gallium config flag - one extra line in the ebuild (here).

Best, sakaki

Brad Q
Posts: 40
Joined: Mon Aug 12, 2019 12:10 am

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Wed Aug 14, 2019 1:08 am

webbsmurfen wrote:
Mon Aug 12, 2019 7:23 am

Just a notice..
Dont use more than 3Gb ( total_mem=3072 ) else the USB/Ethernet will start to behave erratic and malfunction
Could you expand on this a little? Is it just for the 64 bit stuff or does it apply to the standard 32 bit stuff?

Thanks

cjan
Posts: 737
Joined: Sun May 06, 2012 12:00 am

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Wed Aug 14, 2019 2:42 am

so we have 4Gram, can we have gnome/wayland or plasma/wayland in 1.50 version?

webbsmurfen
Posts: 59
Joined: Fri Jun 27, 2014 12:22 pm
Location: Sweden

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Wed Aug 14, 2019 10:51 am

Brad Q wrote:
Wed Aug 14, 2019 1:08 am
webbsmurfen wrote:
Mon Aug 12, 2019 7:23 am

Just a notice..
Dont use more than 3Gb ( total_mem=3072 ) else the USB/Ethernet will start to behave erratic and malfunction
Could you expand on this a little? Is it just for the 64 bit stuff or does it apply to the standard 32 bit stuff?

Thanks
lingon wrote:
Mon Aug 12, 2019 3:36 pm
Have you seen this fresh patch to enable 4 GB RAM?
https://github.com/raspberrypi/linux/is ... -520269280
Yay! I'd missed that - thanks for the heads up. Hopefully this will go into upstream via this PR before too long; if not, I'll add it to my bcm2711-kernel-bis build later this week and test; if it looks OK, I'll ship it with the forthcoming 1.5.0 image ^-^

Best, sakaki
it was an 64 bit issue. However it seems to be fixed now.

User avatar
sakaki
Posts: 381
Joined: Sun Jul 16, 2017 1:11 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Wed Aug 14, 2019 1:49 pm

As promised, I have now pushed through a bcm2711-kernel-bis autobuild, with the necessary patches to remove the 3GiB ceiling, and enable V3D acceleration, on the RPi4 in 64-bit mode (via yaroslavros' PR#3144 and phire's PR#3063).

It is downloadable as a pre-built tarball from here, for those that would like to try ^-^
The version you need is (>=) 4.19.65.20190814.

Full instructions for download / use on that page, but if booted into an existing Pi4 32-bit or 64-bit userland image (that you don't mind hacking with!) you can install it simply by:

Code: Select all

pi4 ~ # wget -cO- https://github.com/sakaki-/bcm2711-kernel-bis/releases/download/4.19.65.20190814/bcm2711-kernel-bis-4.19.65.20190814.tar.xz | tar -xJf- -C /
pi4 ~ # sync
When this completes make sure you have something like the following at the end of your /boot/config.txt

Code: Select all

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
arm_64bit=1
# differentiate from Pi3 64-bit kernels
kernel=kernel8-p4.img
(no need for total_mem!!) and reboot. With luck you should come up under the newly-installed 64-bit kernel.

NB: if you are using Raspbian, even the latest Buster release, you must make sure to update your other boot firmware (/boot/start4*.elf and /boot/fixup4*.dat) using raspi-update (or other favoured route) before rebooting (to ensure you have the version with the GIC armstubs built in, which the above config.txt stanza assumes).

Gentoo users can install via the matching ebuild. I'll have more to say about that as part of the 1.5.0 release docs (forthcoming).

Note that if you are using a 64-bit or non-Raspbian Buster 32-bit userland you must build mesa with the v3d gallium config to use the unlocked V3D acceleration.

Incidentally, I have a trivial script as part of the -bis build process that allows PRs from the raspberrypi/linux tree to be applied (but does nothing if they cannot be cleanly applied). Here is the current version (you need to run it in the root kernel build directory):

Code: Select all

#!/bin/bash
#
# Simple script to patch a baseline RPi kernel source tree, with
# facilities to easily download and apply PRs from:
# https://github.com/raspberrypi/linux/pull/<#>.
#
# Copyright (c) 2019 sakaki <sakaki@deciban.com>
# License: GPL v2.0
# NO WARRANTY
#

set -e
set -u
shopt -s nullglob

# Utility functions

apply_pr() {
    # pr number as $1, comment as $2
    echo "Applying PR#${1}: '${2}':"
    if ! wget -c --quiet \
      https://patch-diff.githubusercontent.com/raw/raspberrypi/linux/pull/${1}.diff \
      -O ${1}.patch; then
        >&2 echo "  Failed to download patchfile for PR#${1}"
    elif [[ ! -s ${1}.patch ]]; then
        >&2 echo "  No non-empty patchfile for PR#${1}"
    elif ! patch -p1 --forward --silent --force --dry-run &>/dev/null \
           < ${1}.patch; then
        >&2 echo "  Failed to apply PR#${1} in dry run - already merged?"
    elif ! patch -p1 --forward --force < ${1}.patch; then
        >&2 echo "  PR#{1} failed to apply - source tree may be corrupt!"
    else
        echo "  PR#${1} applied successfully!"
    fi
    echo
    return 0
}

# Custom kernel patches follow

# Submit PRs with edits targeting the _bottom_ of this file
# Please provide a short rationale comment for the changes made
# The apply_pr() function will not apply a patch if it
# has already been merged, or some part of it will otherwise
# not apply

# apply PR #3063
# credit: phire
apply_pr 3063 "Enable 3D acceleration with 64-bit kernel on RPi4"

# apply PR #3144
# credit: yaroslavros
apply_pr 3144 "Add arm64 pcie bounce buffers; enables 4GiB on RPi4"
This relies on the well-known trick that if you take a GitHub PR URL, and suffix it with '.diff', you can pull down what is effectively a squashed patch for all the PR commits.

So e.g. PR#3063 (enable 3D accel) can be viewed at:

https://github.com/raspberrypi/linux/pull/3063

Asking for

https://github.com/raspberrypi/linux/pull/3063.diff

redirects to

https://patch-diff.githubusercontent.co ... /3063.diff

which yields

Code: Select all

diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index e9bdec0ead72f..3c04f4b9136da 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -16,6 +16,13 @@ config ARCH_ALPINE
 	  This enables support for the Annapurna Labs Alpine
 	  Soc family.
 
+menuconfig ARCH_BCM
+	bool "Broadcom SoC Support"
+	help
+	  This enables support for Broadcom ARM based SoC chips
+
+if ARCH_BCM
+
 config ARCH_BCM2835
 	bool "Broadcom BCM2835 family"
 	select TIMER_OF
@@ -37,6 +44,15 @@ config ARCH_BCM_IPROC
 	help
 	  This enables support for Broadcom iProc based SoCs
 
+config ARCH_BRCMSTB
+	bool "Broadcom Set-Top-Box SoCs"
+	select BRCMSTB_L2_IRQ
+	select GENERIC_IRQ_CHIP
+	help
+	  This enables support for Broadcom's ARMv8 Set Top Box SoCs
+
+endif
+
 config ARCH_BERLIN
 	bool "Marvell Berlin SoC Family"
 	select DW_APB_ICTL
@@ -45,13 +61,6 @@ config ARCH_BERLIN
 	help
 	  This enables support for Marvell Berlin SoC Family
 
-config ARCH_BRCMSTB
-	bool "Broadcom Set-Top-Box SoCs"
-	select BRCMSTB_L2_IRQ
-	select GENERIC_IRQ_CHIP
-	help
-	  This enables support for Broadcom's ARMv8 Set Top Box SoCs
-
 config ARCH_EXYNOS
 	bool "ARMv8 based Samsung Exynos SoC family"
 	select COMMON_CLK_SAMSUNG
diff --git a/arch/arm64/configs/bcm2711_defconfig b/arch/arm64/configs/bcm2711_defconfig
index 3bcce6daa9efd..4dd49d1614d5c 100644
--- a/arch/arm64/configs/bcm2711_defconfig
+++ b/arch/arm64/configs/bcm2711_defconfig
@@ -27,6 +27,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_EMBEDDED=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_PROFILING=y
+CONFIG_ARCH_BCM=y
 CONFIG_ARCH_BCM2835=y
 CONFIG_PCI=y
 CONFIG_PCIE_BRCMSTB=y
@@ -790,6 +791,7 @@ CONFIG_DRM_LOAD_EDID_FIRMWARE=y
 CONFIG_DRM_UDL=m
 CONFIG_DRM_PANEL_SIMPLE=m
 CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m
+CONFIG_DRM_V3D=m
 CONFIG_DRM_VC4=m
 CONFIG_DRM_TINYDRM=m
 CONFIG_TINYDRM_MI0283QT=m
diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig
index c24f505ecd657..902b496d31375 100644
--- a/drivers/soc/bcm/Kconfig
+++ b/drivers/soc/bcm/Kconfig
@@ -3,6 +3,7 @@ menu "Broadcom SoC drivers"
 config BCM2835_POWER
 	bool "BCM2835 power domain driver"
 	depends on ARCH_BCM2835 || (COMPILE_TEST && OF)
+	default y if ARCH_BCM2835
 	select PM_GENERIC_DOMAINS if PM
 	select RESET_CONTROLLER
 	help
hth, sakaki
Last edited by sakaki on Wed Aug 14, 2019 3:07 pm, edited 1 time in total.

User avatar
sakaki
Posts: 381
Joined: Sun Jul 16, 2017 1:11 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Wed Aug 14, 2019 3:02 pm

PR#3144 just got merged upstream.
So the 3GiB ceiling for 64-bit OSes on the RPi4 now put to rest.
Best, sakaki

jimbojones
Posts: 15
Joined: Sun Apr 15, 2018 2:33 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Thu Aug 15, 2019 11:04 am

As always, you’re doing great work, sakaki. Thank you so much :D

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Fri Aug 23, 2019 3:16 pm

Many thanks sakaki for making this happen. The V3D fix came in at just the right time which empowered rpiMike's Minecraft 1.14.4 demo as well as making headway with Dolphin.

Next kernel items I can think of:
* V4L2 M2M codecs means we have some means for accelerated decode, but still unknown as to why MMAL (vlc etc.) isn't working?
* Next steps to fix FIQ for high-speed USB devices? I saw in the part you quoted that rst mentioned one could try setting kernel_old=1 in config.txt. Apparently that loads the kernel at address 0x0 and what's the downside of that?

ErChisus
Posts: 3
Joined: Sat Aug 24, 2019 1:45 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Aug 24, 2019 1:54 pm

I am probably missing some things from my side, but I wanted to install aarch64 packages from the Debian repositories, and all I get are armhf versions. I tried then to use Multiarch, but I get an error message saying that the architecture is not defined in the architecture tables.
Is this even possible or do I have to compile any aarch64 program that I'd like to use?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6051
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Aug 24, 2019 3:03 pm

Isn't it 'arm64' in Debian?

ErChisus
Posts: 3
Joined: Sat Aug 24, 2019 1:45 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Aug 24, 2019 3:10 pm

I think it works as an alias, because I tried to use Multiarch with aarch64 and arm64 and in both cases it complains about aarch64 not being defined.

Cob
Posts: 24
Joined: Tue Mar 05, 2013 2:03 am

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Aug 24, 2019 3:19 pm

This is just a 64bit kernel. It is not a 64 bit userspace. You cannot run 64 bit programs.

It more of a proof-of-concept (although it's been integrated into a number of non-Debian 64 bit distros).

ErChisus
Posts: 3
Joined: Sat Aug 24, 2019 1:45 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Aug 24, 2019 3:26 pm

Oh, right. I didn't realize that. My bad.

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Aug 24, 2019 3:39 pm

It sounds like you were trying to use multiarch on Raspbian (sudo dpkg —add-architecture arm64 then everything that follows). While this is not impossible it requires building an unmaintainable FrankenDebian.

What you really want to do is run a Debian arm64 chroot on Raspbian, then you can apt-get all the arm64 packages you want while retaining Raspbian’s desktop. Follow sakaki’s step-by-step instructions using debootstrap on the first page.

fik
Posts: 13
Joined: Thu Jan 17, 2013 1:34 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Mon Aug 26, 2019 2:07 pm

Hello,

I've installed Sakaki's 64bit bis kernels on both Pi4 and Pi3B+ and it seems the /boot/config.txt parameter arm_64bit=1 is not needed anymore. At least I could not boot the original 32bit kernels removing the parameter or setting it to 0.

If there is a file kernel8.img, it gets booted first, no matter what the arm_64bit parameter says. Fortunately, Sakaki had another name for the Pi4 kernel kernel8-p4.img, to make it different from Pi3. For that you need another /boot/config.txt parameter kernel=kernel8-p4.img.

Then commenting this parameter boots the 32bit kernel. I renamed the Pi3 kernel to kernel8-p3.img, added the parameter and it works. I can switch kernels 64bit and 32bit.

fik
Posts: 13
Joined: Thu Jan 17, 2013 1:34 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Tue Aug 27, 2019 7:01 am

I found out that it actually should have been like that, the arm_64bit parameter is no more necessary as it is now auto-detected:
https://github.com/raspberrypi/firmware/issues/1193

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Wed Sep 04, 2019 4:00 pm

jdonald wrote:
Fri Aug 23, 2019 3:16 pm
* Next steps to fix FIQ for high-speed USB devices? I saw in the part you quoted that rst mentioned one could try setting kernel_old=1 in config.txt. Apparently that loads the kernel at address 0x0 and what's the downside of that?
Question got answered in the thread about 64-bit kernel availability in rpi-update. It turns out the USB issue is specific to Pi 3B+/3B/3A+/2Bv1.2/CM3 with 64-bit kernels, but Pi 4B + 64-bit avoids this problem.

Cob
Posts: 24
Joined: Tue Mar 05, 2013 2:03 am

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Fri Oct 11, 2019 8:35 pm

Is it possible to revert back to the 32 bit kernel?

jdonald
Posts: 417
Joined: Fri Nov 03, 2017 4:36 pm

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Oct 12, 2019 1:43 am

Yes, edit /boot/config.txt and comment out the arm_64bit=1 line.

Edit: I didn’t realize this was the other kernel thread. You may run into issues because there’s another line kernel=kernel8-pi4.img to be undone. You’ll probably have an easier time getting and using 64-bit kernels via rpi-update.

Cob
Posts: 24
Joined: Tue Mar 05, 2013 2:03 am

Re: 64-bit weekly kernel autobuilds for RPi4 released (bcm2711_defconfig)

Sat Oct 12, 2019 11:52 am

jdonald wrote:
Sat Oct 12, 2019 1:43 am
Yes, edit /boot/config.txt and comment out the arm_64bit=1 line.

Edit: I didn’t realize this was the other kernel thread. You may run into issues because there’s another line kernel=kernel8-pi4.img to be undone. You’ll probably have an easier time getting and using 64-bit kernels via rpi-update.
I’ve been running this kernel since it was first published, but something in Thursday and yesterdays batch of firmware updates seems to be conflicting with it. After rebooting after running apt update/upgrade the Rpi can’t find the boot partition. I’m troubleshooting atm.

Return to “General discussion”