From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=ngcx0Iwn; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.128.65, mailfrom: pete@akeo.ie) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by groups.io with SMTP; Wed, 07 Aug 2019 07:24:14 -0700 Received: by mail-wm1-f65.google.com with SMTP id s15so240365wmj.3 for ; Wed, 07 Aug 2019 07:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YddIcQEbVu7TMCj4btREzFqWXtXgenqY22/pTlIxMqw=; b=ngcx0IwnL+Ye6Zp88SeAP9MMYHHwTIeprqOHIgq36/IknrRSpuYKnVcRMjLoYZygwf Llu1R4M36GzX1LdxKMEdVmaQmDCj8Bl7ajxByV+xej3wan9HIoPaJ+UlizD+tXjW8t2K JuhBFL/YPEIK38CcZM1Ns5Gl/Y1uzCe5gpwznjE+DUF+OFFEbaYhNQFH5OPrHi5s8X5I 8augLlkHky3gJWU+ZERCoyw9lMvhD/Sx+e26B/O5I0PWgY7Wh1w9lHf3A895KkNFEBi1 OWKzPg5PBoKQkGAMXyIg/za17R9zXDJGPOXSm6MyC9QGErNRetD8BQLguRh7JOY+iCC6 AYFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YddIcQEbVu7TMCj4btREzFqWXtXgenqY22/pTlIxMqw=; b=Imnr4Obhn4VU8gv2F6sVBK7U0xgX2NwzT97y2350Yv10IIc9y4f4nn54W5v+Yq9rE+ lqN9r1kNOoik6+dT0sepxLGBFuywlcDU0m/eAd8xeJGqTe/IkpRN090Q+iFzWSm79e3g 2F/G/cQw2ZdVyszzN65VXhlaP7xzQV5y+EvjmXYJGakGalhdfK1Jhv80w5PBiWMbYKhO B97/DRQfLrP0gqPfMpAYVKs65IixhuMbDYQR9N25Os4BzhUP6Cpo5xYN51ghLnZx3cuE bVXBC4fXM93z36kShqIoWvYpwJJKBTrKhyyM5QCxghK4zlwNmo1FQlDqs3MmuNnJuLkH /N5A== X-Gm-Message-State: APjAAAXRgVAHRS+TG9K4aEjuvUmnROD2ydiaYUiXO99HGwRRwGqe7urL XdtnLPAFtCl2FKMze/6JAa5Tyw== X-Google-Smtp-Source: APXvYqzb0ep+a3Vuv0VdRyQhNsVCtd3qbDq8Eym7Y4TdnrJ5Dw5wpNO56QD+zCndPDR/CRfKLMXb3A== X-Received: by 2002:a1c:ca06:: with SMTP id a6mr276166wmg.48.1565187853001; Wed, 07 Aug 2019 07:24:13 -0700 (PDT) Return-Path: Received: from [10.0.0.122] ([84.203.61.230]) by smtp.googlemail.com with ESMTPSA id t140sm2814880wmt.0.2019.08.07.07.24.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 07:24:11 -0700 (PDT) Subject: Re: [edk2-platforms: PATCH v2 1/1] Platform/RPi3: Add Debian 10 installation in Systems.md To: Leif Lindholm Cc: devel@edk2.groups.io, ard.biesheuvel@linaro.org References: <20190725152248.10212-1-pete@akeo.ie> <20190725152248.10212-2-pete@akeo.ie> <20190806172522.GK25813@bivouac.eciton.net> From: "Pete Batard" Message-ID: <7fbd53c0-44f5-4fce-c234-6c55786ed610@akeo.ie> Date: Wed, 7 Aug 2019 15:24:10 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190806172522.GK25813@bivouac.eciton.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Hi Leif, On 2019.08.06 18:25, Leif Lindholm wrote: > Minor suggestions inline: > > On Thu, Jul 25, 2019 at 04:22:48PM +0100, Pete Batard wrote: >> This documents the installation of vanilla Debian 10.0 ARM64 (netinst), >> which we validated for both Model B and Model B+. >> Also fix an erroneous reference in an RPi3.fdf comment. >> >> Signed-off-by: Pete Batard >> --- >> Platform/RaspberryPi/RPi3/RPi3.fdf | 2 +- >> Platform/RaspberryPi/RPi3/Readme.md | 4 +- >> Platform/RaspberryPi/RPi3/Systems.md | 124 +++++++++++++++++++- >> 3 files changed, 123 insertions(+), 7 deletions(-) >> >> diff --git a/Platform/RaspberryPi/RPi3/RPi3.fdf b/Platform/RaspberryPi/RPi3/RPi3.fdf >> index c7c3f7a2ab8c..c62d649834c7 100644 >> --- a/Platform/RaspberryPi/RPi3/RPi3.fdf >> +++ b/Platform/RaspberryPi/RPi3/RPi3.fdf >> @@ -300,7 +300,7 @@ [FV.FvMain] >> INF Platform/RaspberryPi/$(PLATFORM_NAME)/Drivers/LogoDxe/LogoDxe.inf >> >> # >> - # FDT (GUID matches mRaspberryPiFfsFileGuid in RaspberryPiPlatformDxe) >> + # FDT (GUID matches gRaspberryPiFdtFileGuid in FdtDxe) >> # >> FILE FREEFORM = DF5DA223-1D27-47C3-8D1B-9A41B55A18BC { >> SECTION RAW = Platform/RaspberryPi/$(PLATFORM_NAME)/DeviceTree/bcm2710-rpi-3-b.dtb >> diff --git a/Platform/RaspberryPi/RPi3/Readme.md b/Platform/RaspberryPi/RPi3/Readme.md >> index 624f3a8d287a..797da1bab4a9 100644 >> --- a/Platform/RaspberryPi/RPi3/Readme.md >> +++ b/Platform/RaspberryPi/RPi3/Readme.md >> @@ -18,8 +18,8 @@ Raspberry Pi is a trademark of the [Raspberry Pi Foundation](http://www.raspberr >> >> This firmware, that has been validated to compile against the current >> [edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms), >> -should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well as Windows 10 ARM64 >> -(full GUI version). >> +should be able to boot Linux (Debian, Ubuntu, SUSE), NetBSD, FreeBSD as well as Windows >> +10 ARM64 (full GUI version). >> >> It also provides support for ATF ([Arm Trusted Platform](https://github.com/ARM-software/arm-trusted-firmware)). >> >> diff --git a/Platform/RaspberryPi/RPi3/Systems.md b/Platform/RaspberryPi/RPi3/Systems.md >> index f6410eb25f0d..4a0c6f3e4de3 100644 >> --- a/Platform/RaspberryPi/RPi3/Systems.md >> +++ b/Platform/RaspberryPi/RPi3/Systems.md >> @@ -1,5 +1,125 @@ >> # Tested Operating Systems >> >> +## Debian >> + >> +[Debian 10](https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/) netinst has been >> +tested and confirmed to work, both on the Model B and Model B+, including installation in >> +either wired or wireless mode. >> + >> +Below are steps you can follow to install Debian 10 onto an SD card: >> +* Partition the media as MBR and create a ~300 MB partition on it with MBR type `0x0e`. >> + __Note:__ Make sure that the partition scheme is MBR (not GPT) and the type `0x0e` (not >> + `0xef` for instance), as the ondie Broadcom bootloader supports neither the GPT scheme nor > > ondie -> on-die (or on-SoC may be even more clear to civilians). I think I'll use "on-CPU" then, as this should be even more explicit. >> + the ESP MBR type. >> +* Set the partition as active/bootable. This is needed as the Debian partition manager can >> + not detect it as ESP otherwise, which we need for GRUB installation. If using `fdisk` on >> + Linux, you can use the `a` command to set a partition as active. On Windows, you can use >> + `DISKPART` and then type `active` after selecting the relevant disk and partition. >> +* Format the partition as FAT. Here again you should make sure that you use FAT rather than >> + FAT32 else the Debian partition manager will not detect the partition as ESP. If you >> + are using Windows `DISKPART` then `format fs=fat quick` should do it. On Linux, `mkfs.vfat` >> + with the default options should do the same as long as the partition isn't too large. > > It would be preferable if we could have an actual number here - the > 12-bit, 16-bit and 32-bit fat size switchover points are known. I > assume it is the 32-bit breakpoint (2 or 4Gb?) we want to avoid? The switchover point actually depends of the utility, since there is overlap between 12, 16 and 32. But that's not actually a problem with diskpart on Windows as 'fs=fat' does force FAT16 so you'll get an error if the partition is too large and can only accommodate FAT32 (which should usually occur past the 2 GB point). In other words, the only potential issue here is with Linux' mkfs.vfat. But there too we can add a switch (-F 16) to force FAT16, so I'll alter the documentation to have that, plus a note that mentions that the partition should be under 2 GB. I'll also take this opportunity to stress out that the only reason we are trying to force FAT16 here is because the Debian installer's partition manager is very temperamental with regards to its detection of an ESP that doesn't have either the relevant GUID for GPT or type 0xef for MBR, none of which can be used on a Pi. There are actually cases where I have seen that utility also detect a FAT32 MBR partition without type 0xef as an ESP. However, I have found out that, in most cases, the presence of FAT32 vs FAT16 acts as a switch to demote the partition from ESP, which is the reason why the notes promote the use of FAT16 over FAT32. But as mentioned in the additional notes however, it's still relatively easy to fix the ESP issue if you use FAT32 and/or if the Debian partition manager fails to detect it as ESP. Now, one can only wish that Broadcom had anticipated UEFI usage for their hardcoded boot loader, as they'd only needed to have added 0xef, alongside the other FAT based MBR partition types they recognize for this whole annoyance to be avoided... I'll send a v3 when I get a chance. Regards, /Pete > > / > Leif > >> +* Copy the UEFI firmware files (`RPI_EFI.fd`, `bootcode.bin`, `fixup.dat` and `start.elf`) >> + as well as an appropriate `config.txt` onto the FAT partition. If needed you can download >> + the non UEFI binary files from https://github.com/raspberrypi/firmware/tree/master/boot. >> +* (Optional) If you plan to install through WiFi, you will need to download relevant non-free >> + WLAN firmware binaries from your WLAN interface (`brcmfmac43430-sdio.txt` and >> + `brcmfmac43430-sdio.bin` for a Raspberry Pi 3 Model B, `brcmfmac43455-sdio.txt` and >> + `brcmfmac43455-sdio.bin` for a Raspberry Pi 3 Model B+). You may also want to obtain the >> + relevant `.clm_blob` (`brcmfmac43430-sdio.clm_blob` or `brcmfmac43455-sdio.clm_blob`), >> + though wireless networking should work even if you do not provide these files. Copy these >> + files either at the root of your FAT partition or into a `firmware/` directory there. >> +* Download the latest `debian-##.#.#-arm64-netinst.iso` from >> + https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/ >> +* Extract the full content of the ISO onto the FAT partition you created. >> +* Insert the media and power up the Raspberry Pi device. >> +* On the GRUB menu select `Install` and let the Debian Installer process start. >> + __Note:__ In case anything goes wrong during the install process, you can use >> + Alt-F4 to check the installation log. >> +* Select your Language, Country and Keyboard and let the installer proceed until it reports >> + that `No Common CD-ROM drive was detected.` >> +* On `Load CD-ROM drivers from removable media` select `No`. >> +* On `Manually select a CD-ROM module and device` select `Yes`. >> +* On `Module needed for accessing the CD-ROM` select `none`. >> +* On `Device file for accessing the CD-ROM` type the following exactly: >> + ``` >> + -t vfat -o rw /dev/mmcblk0p1 >> + ``` >> +* (Optional) If you have copied the non-free WLAN firmware binaries, and plan to install >> + through wireless, you can let the installer select the firmware files. Please be mindful >> + that you may be asked multiple times as there are multiple files to provide. >> +* If requested by the installer, set up your network by choosing the network interface you >> + want to use for installation and (optionally) your access point and credentials. >> +* Go through the hostname, user/password set up and customize those as you see fit. >> +* Let the installer continue until you get to the `Partition disks` screen. There, for >> + `Partitioning method` select `Manual`. You __should__ see something like this: >> + ``` >> + MMC/SD card #1 (mmcblk0) - 16.0 GB SD 2WCGO >> + #1 primary 314.6 MB B K ESP >> + pri/log FREE SPACE >> + ``` >> + In other words, the partition manager should already detect your existing partition as >> + `ESP`, with the `B` (bootable) and `K` (keep data) flags. If that is not the case, (e.g. >> + if it says `fat16` or `fat32` instead of `ESP`) then it probably means you either didn't >> + format the partition to FAT or you forgot to set the bootable flag. If that is the case, >> + refer to the _Additional Notes:_ below. >> +* Select `FREE SPACE` → `Create a new partition` and create a `1 GB` primary `swap` >> + partition. >> +* Select `FREE SPACE` → `Create a new partition` and allocate the rest to a primary >> + `ext4` root partition (mountpoint = `/`) >> +* After doing the above, your partition report should look like this: >> + ``` >> + MMC/SD card #1 (mmcblk0) - 16.0 GB SD 2WCGO >> + #1 primary 314.6 MB B K ESP >> + #2 primary 1.0 GB f swap swap >> + #3 primary 14.7 GB f ext4 / >> + ``` >> +* Select `Finish partitioning and write changes to disk` and then `Yes` and let the >> + installer continue with the base system installation. >> +* After a while, the installer should produce a message that states: >> + ``` >> + [!!] Configure the package manager >> + >> + apt-configuration problem >> + An attempt to configure apt to install additional packages from the CD failed. >> + ``` >> + This is a __benign__ message that you can safely ignore by selecting `Continue` (The >> + reason it is benign is we are running a net install and won't need to access the "CD-ROM" >> + files post install). >> +* Once you have dimissed the message above, pick the mirror closest to your geographical >> + location and let the installer proceed with some more software installation. >> +* Finally, at the `Software selection` screen, choose any additional software package you >> + wish to install. `Debian desktop environment` should work out of the box if you choose to >> + install it. >> +* Let the process finalize the software and GRUB bootloader installation and, provided you >> + didn't run into the partition manager issue described above (installation partition not >> + seen as `ESP`) you can reboot your machine when prompted, which, once completed, should >> + bring you to your newly installed Debian environment. >> + >> +### Additional Notes for Debian >> + >> +The reason we use `-t vfat -o rw /dev/mmcblk0p1` for the source media (i.e. "CD-ROM" device) >> +is because, whereas the first partition on the SD card is indeed `/dev/mmcblk0p1`, we also >> +need to provide additional parameters for the `mount` command that the installer invokes >> +behind the scenes. For instance, if we don't use `-t vfat`, then ISO-9660 is forced as the >> +file system, and if we don't use `-o rw` then the partition will be mounted as read-only >> +which then prevents the same partition from being remounted when locating the non-free >> +firmware files or when setting up `/efi/boot`. >> + >> +With regards to fixing the partitioning if you don't see `B K ESP` when entering the >> +partition manager, what you need to do is: >> +* Before you create the additional partitions, select the first partition and change its >> + type to `ESP`. Note however that doing this will change the type of the partition to `0xef` >> + which is precisely what we're trying to avoid by having the partition manager already >> + detect it as ESP, as type `0xef` is __unbootable__ by the Broadcom CPU. >> +* To fix this then, before you choose `Continue` on the `Installation complete` prompt you >> + need to open a new console (Alt-F2) and then type: >> + ``` >> + chroot /target fdisk /dev/mmcblk0 >> + ``` >> + Then press t, 1, e w, to reset the partition >> + to type `0x0e` (FAT16 LBA). >> + >> ## Ubuntu >> >> [Ubuntu 18.04 LTS](http://releases.ubuntu.com/18.04/) has been tested and confirmed to work, >> @@ -35,10 +155,6 @@ Then, to have your changes applied run `update-grub` and reboot. >> >> ## Other Linux distributions >> >> -* Debian ARM64 does not currently work, most likely due to missing required module support >> - in its kernel. However its installation process works, so it may be possible to get it >> - running with a custom kernel. >> - >> * OpenSUSE Leap 42.3 has been reported to work on Raspberry 3 Model B. >> >> * Other ARM64 Linux releases, that support UEFI boot and have the required hardware support >> -- >> 2.21.0.windows.1 >>