Booting with custom compiled kernel

Hey,

I just got the board (le potato) a couple days ago. I flashed ubuntu to the SD card and that can boot no problem.

My eventual goal is to run Gentoo on this thing, so I set about trying to get a custom kernel running. Unfortunately, I haven’t had any success with this. I’ve worked backwards to the point where I’m just compiling with default parameters and I’m still not able to boot successfully.

What I’ve done:

  1. Flashed bootloader using the lft, no problems there, it works fine.
  2. Compiled kernel (libre-computer-project/libretech-linux branch v6.0/libretech-master) using the default parameters (make defconfig) and moved the compiled kernel to the EFI partition
  3. Booted using bootefi

The kernel does boot, but I don’t get any output beyond the EFI stub. Recompiling with no DRM gets me console output, and it shows that the root filesystem is mounted successfully. I currently have init=/bin/sh for debugging, and while I get the message that it is calling /bin/sh as init, nothing happens after that. The system just hangs.

There are no errors or kernel panic or anything. Using sysrq keys still generates console output, as does removing / inserting USB devices.

Am I missing something in the boot sequence? My best guess is I’m missing something to do with hardware initialization. Help would be greatly appreciated!

  1. You need to feed $fdtcontroladdr to bootefi.
  2. You can turn on debug and set the console via console= parameter with the board’s UART or tty.
  3. If init=/bin/sh shows nothing on console, it simply means that executable did not start properly.

Did you get the custom kernel figured out? I have gentoo running but I haven’t tested a custom kernel yet. I’m using the kernel from the supplied Raspian image as of yet. I cheated though…

Running raspian on on microsd card I used a usb adapter to install gentoo…

  1. I wrote the raspian image to a microsd(in the usb adapter).
  2. Deleted the root partition and created a new one and swap partition.
  3. Mounted the new root partition to /mnt/gentoo
  4. Mounted the existing EFI parition to /mnt/gentoo/boot/efi
  5. extracted the stage3 tarball to /mnt/gentoo as normal
  6. used lsmod output to create module list in /mnt/gentoo/etc/modules-load.d/
  7. cp -rp the linux firmware, kernel modules and the rest of the boot directory from raspian
  8. mainly followed the gentoo handbook for amd64 chroot etc
  9. my eth dev is end0
  10. edit inittab so i can use the UART interface
# Architecture specific features
f0:12345:respawn:/sbin/agetty 115200 ttyAML0 vt100
  1. emerge grub with efi-64 (/etc/portage/make.conf GRUB_PLATFORMS=“efi-64”)
  2. grub-mkconfig -o /boot/grub/grub.cfg
  3. grub-mkstandalone -O arm64-efi -o /boot/efi/EFI/BOOT/BOOTAA64.EFI “boot/grub/grub.cfg=/boot/grub/grub.cfg”
  4. exit/umount/take the gentoo card out of the usb adapter and put in the microsd slot in the board replacing the raspian one and reboot

I am attempting a custom kernel as well now using the same source you are and the config from the raspian boot dir. I just basically added mouse_dev for gpm at this point and we’ll see how that goes and i’ll clean up and strip the kernel the way i’ve always done with an x86 kernel. Hopefully it goes well. I’m curious if any of the modules in use only work as modules or anything you’ve learned…

UPDATE: using the source OP mentioned, started with config from raspian image compiles and installs fine, added a couple things and started stripping stuff out, following standard gentoo for creating dracut, installing modules works fine. Generate grub config as normal and reinstall standalone grub EFI using command above. Boots and works as expected.

What cflags did you use for make.conf?

We will have first party Gentoo support within the next month or so.

I am curious if this has been posted yet? Very interested in getting Gentoo running.

Are we there yet? :slight_smile:

I am really looking forward to this support!

Here is my make.conf… minus my bin host and overlay dir.

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-O2 -pipe -march=native"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
CHOST="aarch64-unknown-linux-gnu"
MAKEOPTS="-j4"
# NOTE: This stage was built with the bindist Use flag enabled

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C
USE="-X gpm fbcon alsa -udev"
ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"
GRUB_PLATFORMS="efi-64"
PORTDIR_OVERLAY="redacted"
GENTOO_MIRRORS="rsync://rsync.gtlib.gatech.edu/gentoo"
FEATURES="getbinpkg buildpkg"
PKGDIR=/var/potato/binpkgs/
VIDEO_CARDS="lima"

Here is my wiki with my notes on running gentoo if it helps… libre_computer_board_aml-s905x-cc_le_potato [Adrenlinerush Wiki]