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

Dedicated image for the Lenovo Thinkpad X13s #330

Closed
wants to merge 6 commits into from

Conversation

jglathe
Copy link

@jglathe jglathe commented May 29, 2024

This is sort of experimental, me trying to get a handle on how this works. The changes are v1.0, still with local dependencies, I will put up all of it into github repos, after creating some order. There are a few things noteworthy, though.

  1. Lenovo Thinkpad X13s is an aarch64 target, you need a device tree to successfully boot it. There seems to be no real mechanism to detect / select / provide this from the ISO yet. There is a (beta) mechanism in the UEFI BIOS to load the dtb from the ESP and provide it to the kernel, and this works (with Ubuntu at least). But this is outside of the ISO, and these boxes aren't shipped with the dtb. Future Snapdragon X Elite based boxes may be, but there is still the issue that there is no standard way on how this may work (yet).
  2. You also need boot-critical drivers to load first from the initramfs, and certain firmwares (for the coprocessors, adsp and cdsp, gpu) need to be in the initramfs, too.
  3. I (hopefully) understood the boot part so far that it is using parts of grub-efi-aarch64 to bring it up from the iso. My experience with trying to use systemd-boot with these uefi BIOSes (even though we have efivars now on x13s) is rather poor. The installed system on an external SSD, when connected to the laptop, will cause it not to boot. I can boot when I remove the ESP, and boot via an already existing grub. I do so on a Windows Dev Kit 2023, same SoC. Maybe going grub for aarch64 until this works is worth a consideration.
  4. You need specific kernel options to make it boot due to the incompleteness of some hardware definitions. AFAIU this is not really an exception.
  5. I used my own deb packages for the kernel, but you can do this with the pop-os_linux tree too, but you need different kernel options for it to work.

In conclusion this means that you maybe can build an ISO to boot for these targets, but its not generic at all. At least yet. So branches / configurations for specific targets may be the way to get something for the time being.

First working make of this build script. Key needs to be replaced by the local user key.

Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
@jglathe jglathe changed the base branch from master to noble May 29, 2024 20:31
@jackpot51
Copy link
Member

This touches too many things and is not clean enough to accept. I am also very skeptical of having device-specific images. In my mind, the future of aarch64 is to have UEFI support and upstream Linux kernel support. We won't want to hold many device-specific ISOs and they would all require device-specific testing.

@jackpot51 jackpot51 closed this May 29, 2024
mk/iso.mk Outdated
@@ -14,18 +14,23 @@ $(BUILD)/iso_casper.tag: $(BUILD)/live $(BUILD)/chroot.tag $(BUILD)/live.tag $(B
# Create new casper directory
mkdir -p "$(BUILD)/iso/$(CASPER_PATH)"

ifeq ($(DISTRO_MACHINE),x13s)
# copy over dtb to casper
cp -v "$(BUILD)/live/usr/lib/linux-image-6.9.1+/qcom/sc8280xp-lenovo-thinkpad-x13s.dtb" "$(BUILD)/iso/$(CASPER_PATH)/$(DISTRO_MACHINE_DTB)"

Choose a reason for hiding this comment

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

Why not copy all DTBs? That way, more ARM platforms that boot using DT over ACPI. I know that NixOS and Rocky Linux currently boot like this: U-Boot -> GRUB -> Linux. While you really only need the FDT in U-Boot and can boot without the in-kernel DTB, it's not recommended.

Jeremy and Aron: Sorry for hijacking this :P

Copy link
Author

Choose a reason for hiding this comment

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

Hmm how do you select the right one when its available, you need to do so before loading linux.

Copy link
Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

You just place all DTBs in /boot/dtb and the bootloader picks it up.

Copy link
Author

Choose a reason for hiding this comment

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

You just place all DTBs in /boot/dtb and the bootloader picks it up.

... which one? OTOH, as described, initramfs is a bit special (won't boot, or only from nvme, if the modules and firmware hooks aren't there). For me this sounds a lot like you still need a device specific layer of code, even if we manage to get something like dtbloader figures out the right dtb. But this would be doable for one image, at least.

Choose a reason for hiding this comment

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

Putting the DTBs in the necessary paths is already handled by the .deb package of the kernel. This shouldn't be done manually.

Copy link
Author

Choose a reason for hiding this comment

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

... if it works. It depends on flash-kernel, and my impression was that it doesn't, haven't found the cause yet. Therefore the direct command as a workaround / hack, as the whole thing currently is.

@jackpot51
Copy link
Member

I am re-opening this because I think there are some things we can do to improve the situation for ARM devices, while still hoping for complete upstream kernel support.

In particular, our ISOs are missing the devicetree files from the included kernel. We should not just include the files from one device (the X13s), but instead should include all of the files, and ensure that the bootloader correctly loads them.

@jackpot51 jackpot51 reopened this Jun 11, 2024
@jglathe
Copy link
Author

jglathe commented Jun 11, 2024

Which opens the topic discussed above. I guess you need a few things:

  • detection of machine
  • specific initramfs support (for qcom especially as it seems)
  • boot parameters for the grub entry
  • kernel config that has all required features / modules on

It will probably be an incremental work going from device(class) to device. I have two pretty similar boxes, the X13s, and the Windows Dev Kit 2023. They boot with the same kernel, modules list and config, have separate dtbs. And a part of the firmware is signed device-specific.

@jglathe
Copy link
Author

jglathe commented Jun 11, 2024

flash-kernel works with dtb installation on the 24.04 install, btw. Haven't tried to boot anew with systemd-boot yet.

scripts and firmware for X13s reside now in the submodule data/syshacks
change installed kernel to 6.9.3-76060903-generic

Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
this is to ensure its not loaded from rootfs

Loading the adsp firmware leads to a short interruption on the
USB type-c VBUS line. A not self-powered device on that bus needs
to be re-detected then. If you've booted from type-c and you
have the rootfs already mounted, it is game over since the rootfs
is now inoperable.

Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
@jackpot51 jackpot51 deleted the branch pop-os:noble September 18, 2024 16:35
@jackpot51 jackpot51 closed this Sep 18, 2024
@jackpot51
Copy link
Member

Now that the noble branch is merged, this will have to be reopened on the master branch.

@jglathe
Copy link
Author

jglathe commented Sep 18, 2024

With an updated version. For boot-only (and install) purposes you can forego all firmwares except for the gpu firmware, and one needs a modules list. Then it boots on sc8280xp and x1e80100. With dtbloader it might be feasible to actually boot by arm64 machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants