Creating a rootfs image (Raspberry Pi 4)

Latest response

Hey I'm looking to create an image for my raspberry pi to boot, but the provided binary/boot RHEL 8 isos all required EFI compatibility to boot.

I've had luck downloading the KVM guest images and extracting the XFS partition, but they seem to be read only file systems.

So right now I'm looking to either:

a. Make the file system read/write again
b. Generate an aarch64 image with everything already installed

As for b, Image Builder looked promising, but I don't think I can use an x86_64 machine to generate aarch64 images, so I'm just kind of stuck right now

EDIT: Also I currently have a running RHEL 8 cloud image on my pi, but like I said, the filesystem is read only right now.

EDIT 2: Looks like my UUID changed, updated my fstab and root file system is writeable now

Responses

I've actually never tried to boot rpi in aarch64 (way behind in my to-do list), but here's my 5 cents.

1) kernel, I don't think RHEL stock kernel will boot on an RPi4, seems too new, maybe start testing in older devices .

2) EFI, in theory, you could use uboot to load EFI, and uboot can be loaded from the rpi loader.

3) Image, yeap, you need the right arch to generate the image, but since you managed to load the guest in KVM, that should be solved.

Having said all this, I wouldn't do any of it and actually start testing everything in Fedora, where you know you have all the latest things. Once you have the right steps, go back to RHEL and test again.

HTH. Pablo.

Tucker Thomas,

Thanks for posting about this. Please keep us informed in this discussion on your progress with this (sorry, I've not gone down this path for RHEL+RaspberryPi)

Regards

RJ

Hello,

Just here to Necro this thread and see if the aarch64 image is compatible with the pi4. I know CentOS was compatible so I am assuming RHEL is probably compatible, but just wanted to check :)

I was able to get it working on the Rpi 400 with safe mode graphics, but I was unable to get the networking to work. Neither ethernet or wifi worked. it did see a mobile device via usb, hoping to get hotspot working but that too failed!

Really great!!! Wait for more good news later on.

I tried to achieve the same and found out that it is actually very possible.

The long way is to set up a VM with Image Builder, but if you create the vm with an emulator such as QEMU on an x86_64 chances are that making the rootfs will take ages and ages.

The fastest way is to extract it from the qcow2 image.

Now, the rootfs is useful if you want to avoid the EFI boot on a raspberry pi (which is highly experimental) because the raspberry pi by default loads a kernel from the so called "boot" partition and you can configure which root partition to use in the "cmdline.txt" file. Beware that you won't be able to use the RHEL kernel but you will need to use the Raspberry Pi OS kernel instead. If you also want wifi connectivity you'll need to copy the Raspberry Pi OS linux firmware to the /lib/firmware folder (https://github.com/RPi-Distro/firmware-nonfree)

If you do want to EFI boot your pi you can use the RHEL dvd iso to install RHEL by using the https://github.com/pftf/RPi4 uefi for raspberry pi 4 but there is no support for networking, gpio, etc. (with the integrated devices on the pi)

I've gone down this second route, I have taken the ARM ISO, mounted it, copied the contents to a bootable FAT16 partition on an SD card and added the UEFI firmware. Everything boots, UEFI hands to the installation kernel (after a bit of a wait) and then reaches the basic target at which point dracut-initqueue times out and dumps me to the emergency shell. From dracut I can't locate any disks to symlink into place to continue booting? Any pointers what to do now would be very appreciated, even a 10'000ft view description would grand as I appreciate I'm on my own here. I used a similar process to get Fedora 34 installed so have that as a sort of bootstrap environment if I need to rebuild the installation image with the raspberry kernel in?

The stock RHEL 8.X kernel is not made to support the Raspberry Pi: if you go and check the kernel configuration used by Red Hat for aarch64 architecture you might notice that drivers required by a Raspberry Pi are not selected (not even as modules), therefore chances are the kernel cannot find the SD drive because doesn't have drivers for it.

Now, if you're thinking you just need to build the official Red Hat kernel with the right drivers you're wrong (I tried) because the build will fail. Now, my guess is that Red Had did not necessarily maintained compatibility with all drivers in the Linux kernel while backporting newer versions to 4.18, so basically you can only boot usb drives (assuming drivers are present in the kernel, which I'm not sure).

Regarding the official raspberry pi kernel, note that it is best booted the official way (I think the UEFI firmware wouldn't be able to boot it, but I might be proven wrong) and it's the only one that enables all the devices to work properly.

If you really want to use the UEFI firmware I'd suggest you stick to Fedora 34 which supports most of the devices included in the Raspberry Pi and it's proven to work because of its more recent and more 'vanilla' kernels.

That said what I did was create a custom drive by creating two partitions (one for the kernel, dtb, config, etc., and one for the root). I copied in the root the files extracted from a qcow image generated with the official image creation tool. I copied in the boot partition a raspberry pi kernel (as well as the other necessary files) that I built myself to support SELinux and other functionalities and after creating a ".autorelabel" file in the root folder ("/") I was able to boot RHEL 8 on my Raspberry Pi, being aware that I needed to manually manage kernel upgrades and that the kernel I built is probably not as secure as the one provided by Red Hat. Unfortunately this is the way it is... Red Hat is an Enterprise OS that supports enterprise server hardware and not a cheap community supported SBC.