WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: 64-bit kernel with 32-bit apps  (Read 701 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
64-bit kernel with 32-bit apps
« on: August 28, 2023, 08:47:26 AM »
Hi, all.

We usually call this layout, the Core64 configuration,
 where you take the 64-bit kernel with modules and bundle them with the 32-bit playground

I figure, it can be done on RPI as well, just never get the motivation to actually try it out.

I'm working on NodeJS (required by firefox) and I'm having some memory problem.

Since Paul had mentioned hitting the memory limit for a single process, it wasn't that hard to figure out the cause of my trouble.
32-bit adress space is not enough for lld linker to produce the final product.

Considered that most of the building process has passed (1543/1593), it wouldn't hurt if I'm only doing the linking with a 64-bit kernel.

So, I grabbed my armv7 SD card, replace everything in the first partition with aarch64 files.
Copy rootfs-piCore-14.0.gz, cmdline.txt and config.txt over and adjust a little.
Code: [Select]
#initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7.gz followkernel
#kernel kernel6125v7.img
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v8.gz followkernel
kernel kernel6125v8.img
arm_64bit=1

The pi boots, all the 32-bit apps run just fine.
I complete my compilation and undo all my changes above and go back to armv7.
Code: [Select]
$ file out/Release/node
out/Release/node: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 5.15.1, not stripped

The binary runs just fine, if you think it's OK, then I'll send it so you can have a look at it.

P.S. I accidentally downloaded node-16.20.2 rather then node-18.17.1
Apparently, both node16 and node18 are ESR and I just so happened to visit their site between the 5 hour window when they put on node16 but haven't upload node18 yet.
I guess I could submit them both, but would you accept ?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14583
Re: 64-bit kernel with 32-bit apps
« Reply #1 on: August 28, 2023, 08:59:29 AM »
Interesting, if the result runs in pure 32bit it should be good - I think one version of node would be enough.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
Re: 64-bit kernel with 32-bit apps
« Reply #2 on: August 28, 2023, 09:38:52 AM »
Oh, I forgot to say. Node has dropped support on armv6.

My node16 didn't hit the memory block and is 100% compiled on/for armv7.

Node18 use the same setting, only the very few files at the end of compilation were done on 64-bit kernel.

I guess I should send Node18 ?

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1089
Re: 64-bit kernel with 32-bit apps
« Reply #3 on: August 28, 2023, 09:41:40 AM »
RaspiOS still allows you to run a 64bit kernel with 32bit userspace, the 32bit image includes 4 kernels  (armv6, armv7, armv7l, armv8)

As long as the only thing you grab from the aarch64 repository are the kernel modules, this will be fine.  I ran this way for a long time before we had an aarch64.   Compiling becomes extra tricky for an accurate triplet, but everything you did sounds correct.



Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14583
Re: 64-bit kernel with 32-bit apps
« Reply #4 on: August 28, 2023, 09:42:45 AM »
Yeah - you might as well submit the most recent version - please mention that it’s not for armv6 when you submit.