aarch64-laptops / debian-cdimage

79 stars 11 forks source link

Debian CD Image for AArch64 Laptops

The repository contains the Debian CD image releases for AArch64 Laptops. The CD image works on AArch64 laptops in the same way as what people usually see on x86 devices. This guide only highlights the quirks we need to deal with on AArch64 laptops. The CD image is tested on Lenovo Yoga C630 and Flex 5G laptops with the following conditions.

Installer limitations

After installation completes, you will get a fully functional kernel booting with device tree. But installer kernel boots up with ACPI and only provides a minimal support required by installation, like display via efifb, HID devices, USB and UFS.

Installation tips

Although the installation is intuitive and Debian install guide could be found here, we would like to give a few tips you might find them useful.

AArch64 quirks

If everything goes fine, you will get Installation complete prompt in the end. However, it's not really completed yet for AArch64 devices, as we need to run UEFI Shell.efi for a couple of reasons.

Follow the steps below to launch Shell.efi for completing installation.

  1. From Debian Installation complete prompt, reboot with leaving USB disk plugged-in. Press 'c' in Grub menu to get 'grub> ' command-line prompt.

  2. Launch Shell.efi that resides in USB disk like below.

grub> chainloader (hd0,msdos2)/efi/shell/Shell.efi
grub> boot
  1. Identify the FS number of ESP partition on UFS by checking there are DtbLoader.efi and grubaa64.efi in EFI\debian folder. For example, it's fs5: on Lenovo Yoga C630 and fs4: on Flex 5G.
Shell> map -r -b
Shell> fs5:
FS5:\> ls EFI\debian
  1. Modify EFI variable Boot#### to get it point to DtbLoader.efi. The number 2 in the second command is identified by looking at Option field in the first command output.
FS5:\> bcfg boot dump
...
Option 02. Variable: Boot0001
  Desc   - Windows Boot Manager
...
FS5:\> bcfg boot modf 2 EFI\debian\DtbLoader.efi

Note: In case there is no Boot option, for example on the fresh Flex 5G system, use the following command to add an option for DtbLoader.efi.

FS4:\> bcfg boot dump
No options found.
FS4:\> bcfg boot add 0 EFI\debian\DtbLoader.efi "DtbLoader"
  1. Now installation really completes. Remove the USB disk and reboot like below.
FS5:\> reset

Firmware installation

At this point, you should be able to boot up and login Debian system. However, some hardware blocks are not working properly yet because firmware is missing. Follow steps below to install firmware.

  1. Add user to sudo group.
$ su - root
$ usermod -aG sudo <username>
$ exit
$ su - <username>
  1. Run firmware extract script to retrieve firmware files that we cannot find in linux-firmware repository from Windows partition. This is a cut-down version of a script from the Celliwig project.
  1. Reboot the device.

Debian first-run

Here are a few things that you want to set up to get the best experience.

Lenovo Yoga C630

  1. Go to Settings and set up Wi-Fi to get a network connection.

  2. Update /etc/apt/sources.list with the best Debian mirror per your location, drop sid-security repository which doesn't have a Release file.

$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian sid main
deb-src http://deb.debian.org/debian sid main
$ sudo apt update
  1. Install alsa-ucm-conf from Linaro OBS to enable audio.
$ sudo apt install alsa-ucm-conf
$ pulseaudio -k

Lenovo Flex 5G

The support of Lenovo Flex 5G is half-baked at this point. The graphic support is not available yet. Follow the example below to setup WiFi with command-line.

nmcli con add con-name WiFi ifname wlan0 type wifi ssid <Your_Network_SSID>
nmcli con modify WiFi wifi-sec.key-mgmt wpa-psk
nmcli con modify WiFi wifi-sec.psk <Your_WiFi_Password>
nmcli con up WiFi

Kernel upgrade

Kernel for the laptops can be natively rebuilt and upgraded with the following steps (kernel 5.13 as example).

  1. Install dependencies

    $ sudo apt install bc bison flex libssl-dev rsync
  2. Check out kernel source

    $ git clone https://github.com/aarch64-laptops/linux.git
    $ cd linux
    $ git checkout -b laptops-5.13 origin/laptops-5.13
  3. Build binary kernel deb package

    $ make distro_defconfig
    $ make LOCALVERSION="-custom" -j8 bindeb-pkg

    After build completes, the following deb files will be found in parent folder.

    • linux-image-5.13.0-custom_5.13.0-custom-1_arm64.deb
    • linux-headers-5.13.0-custom_5.13.0-custom-1_arm64.deb
    • linux-libc-dev_5.13.0-custom-1_arm64.deb
  4. Install kernel package

    $ sudo dpkg -i linux-image-5.13.0-custom_5.13.0-custom-1_arm64.deb
  5. Upgrade DTB

    $ sudo python3 /usr/local/bin/install-dtbs.py /usr/lib/linux-image-5.13.0-custom /boot/efi/dtb

Misc tips

$ sudo apt install xinit