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

Adding NOTE about building 32-bit kernel #3027

Merged
merged 2 commits into from
Jul 27, 2023
Merged

Adding NOTE about building 32-bit kernel #3027

merged 2 commits into from
Jul 27, 2023

Conversation

aallan
Copy link
Contributor

@aallan aallan commented Jul 27, 2023

If you are attempting to compile a 32-bit kernel on the 32-bit distribution of Raspberry Pi OS you should be aware that while the userland in this distribution is 32-bit, the kernel is a 64-bit kernel. You should therefore follow the instructions for cross-compiling the kernel.

Closes #3019 when merged.

If you are attempting to compile a 32-bit kernel on the 32-bit distribution of Raspberry Pi OS you should be aware that while the userland in this distribution is 32-bit, the kernel is a 64-bit kernel. You should therefore follow the instructions for cross-compiling the kernel.
@aallan aallan added documentation linux It's a linux or kernel related issue labels Jul 27, 2023
@pelwell
Copy link
Contributor

pelwell commented Jul 27, 2023

That doesn't quite match my comment on #3019:

Following the cross-compilation instructions for the 64-bit and 32-bit kernel removes the need for guesswork.
However, on the case of building 32-bit kernel on top of a 32-bit OS with a 64-bit kernel, the only necessary change is ARCH=arm

In other words, building the 64-bit kernel on the 32-bit OS is more of a cross-compilation exercise because it requires the installation of the cross-compiler (which is what gcc-aarch64-linux-gnu is on the 32-bit OS). Building the 32-bit kernel on the 64-bit kernel + 32-bit OS combo just needs the ARCH=arm hint, although it's likely that users wanting to build the 32-bit kernel will already be selecting it with arm_64bit=0.

@aallan aallan merged commit 0e99ba4 into develop Jul 27, 2023
1 check passed
@aallan aallan deleted the aallan-patch-1 branch July 27, 2023 14:09
@mtaunton
Copy link

@aallan Re your changes in commit [0e99ba4].

Sorry, I hate to be awkward, but I still find the wording problematic.

To build a 32-bit kernel on 32-bit Raspberry Pi OS, it says to "set ARCH=arm", but doesn't explain how / where you do that. I assume it has to be given at least as an extra argument when making the default configuration, namely as:

make ARCH=arm bcm2711_defconfig

Is that correct / sufficient? Or does ARCH=arm need to be added also to the make command that builds the kernel itself?

Further, mentioning the possibility that "arm_64bit=0 will have been set" is misleading. If the user is indeed building a "32-bit kernel on the 32-bit distribution of Raspberry Pi OS — which has a 32-bit userland, and 64-bit kernel", then arm_64bit=1 cannot have been set, since the kernel by default is explicitly a "64-bit kernel".

@@ -12,6 +12,8 @@ The instructions below are divided into native builds and cross-compilation; cho

=== Building the Kernel Locally

IMPORTANT: Building the 64-bit kernel on the 32-bit distribution of Raspberry Pi OS is a cross-compilation exercise because it requires the installation of the cross-compiler (`gcc-aarch64-linux-gnu`). Building the 32-bit kernel on the 32-bit distribution of Raspberry Pi OS — which has a 32-bit userland, and 64-bit kernel — you should set `ARCH=arm`, although it's likely that this may already be set as `arm_64bit=0` will have been set. Instructions for <<cross-compiling-the-kernel,cross-compiling the kernel>> can be found later on this page.
Copy link
Contributor

@lurch lurch Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the 32-bit distribution of Raspberry Pi OS — which has a 32-bit userland, and 64-bit kernel" - that's only the case on Pi 4B, Pi 400, CM4 and CM4S ? https://www.raspberrypi.com/documentation/computers/config_txt.html#arm_64bit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, unless the user has explicitly set arm_64bit=1 on BCM2710-based device.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lurch Can you nip in and fix that up?

@aallan
Copy link
Contributor Author

aallan commented Jul 27, 2023

Sorry, I hate to be awkward, but I still find the wording problematic.

Suggestions for revised wording are welcome.

@mtaunton
Copy link

OK, will give it a go (but not immediately, maybe tomorrow).

@mtaunton
Copy link

mtaunton commented Jul 27, 2023

In the meantime, could someone (@pelwell?) answer my previous question, namely:

To build a 32-bit kernel on 32-bit Raspberry Pi OS, it says to "set ARCH=arm", but doesn't explain how / where you do that. I assume it has to be given at least as an extra argument when making the default configuration, namely as:

make ARCH=arm bcm2711_defconfig

Is that correct / sufficient? Or does ARCH=arm need to be added (also) to the make command that builds the kernel itself?

@pelwell
Copy link
Contributor

pelwell commented Jul 27, 2023

You can pass it to each make call or make it available to all subsequent make invocations with... export ARCH=arm.

@mtaunton
Copy link

So do both "make" calls need ARCH to be set, ie the setting of various values in .config by "make bcm2711_defconfig" is not sufficient?

@pelwell
Copy link
Contributor

pelwell commented Jul 27, 2023

You can pass it to each make call

So yes, both/all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation linux It's a linux or kernel related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problems following instructions to build Kernel
4 participants