flatcar / Flatcar

Flatcar project repository for issue tracking, project documentation, etc.
https://www.flatcar.org/
Apache License 2.0
681 stars 30 forks source link

[RFE] Provide RaspberryPi 4 images #502

Open jepio opened 3 years ago

jepio commented 3 years ago

Current situation

It is possible to boot current arm64 alpha images (2983.0.0) on RaspberryPi 4, but there are several manual steps needed to perform the setup and to gain SSH access to the board.

Impact

It is hard for people to play around with Flatcar on a very popular platform.

Ideal future situation

We provide pre-built images with raspberrypi specific configuration, and some nice beginner friendly documentation (not assuming too much Flatcar knowledge) to perform installation and bring-up.

Implementation options

Some suggestions will follow in the next comments.

Additional information

Flatcar requires on ARM requires UEFI and ACPI support. This is available for RPI4 at https://github.com/pftf/RPi4 but not for other PIs, or many other boards.

jepio commented 3 years ago

I have this working on my own RaspberryPi and here's a rough description of the steps required and my WIP state. There is an easy way to get it working and a nice way.

The easy way

You need an SD card and a USB stick (min 8GB).

SD card

  1. Format the SD card with MSDOS partition table, and create a single FAT partition.
  2. Mount the FAT partition and unpack the contents of https://github.com/pftf/RPi4/releases/download/v1.28/RPi4_UEFI_Firmware_v1.28.zip to it.
  3. You may be able to use a newer release from https://github.com/pftf/RPi4/releases, but thing occasionally break. I tested with v1.29, there are reports of various problems with v1.30.

USB

  1. Insert an unformatted USB stick
  2. Fetch https://github.com/kinvolk/init/blob/flatcar-master/bin/flatcar-install
  3. Save the following as config.yaml
    storage:
    filesystems:
    - name: "OEM"
      mount:
        device: "/dev/disk/by-label/OEM"
        format: "btrfs"
    files:
    - filesystem: "OEM"
      path: "/grub.cfg"
      mode: 0644
      append: true
      contents:
        inline: |
          set linux_console="console=ttyAMA0,115200n8 console=tty1"
          set linux_append="flatcar.autologin usbcore.autosuspend=-1"
    passwd:
    users:
    - name: core
      ssh_authorized_keys:
        - <INSERT YOUR SSH PUBKEY HERE>

    Fill in your ssh public key, and transpile the config using ct <config.yaml >config.json. (https://github.com/kinvolk/container-linux-config-transpiler). Here is the json version:

    {
    "ignition": {
    "config": {},
    "security": {
      "tls": {}
    },
    "timeouts": {},
    "version": "2.3.0"
    },
    "networkd": {},
    "passwd": {
    "users": [
      {
        "name": "core",
        "sshAuthorizedKeys": [
          "<INSERT YOUR SSH PUBKEY HERE>"
        ]
      }
    ]
    },
    "storage": {
    "files": [
      {
        "filesystem": "OEM",
        "path": "/grub.cfg",
        "append": true,
        "contents": {
          "source": "data:,set%20linux_console%3D%22console%3DttyAMA0%2C115200n8%20console%3Dtty1%22%0Aset%20linux_append%3D%22flatcar.autologin%20usbcore.autosuspend%3D-1%22%0A",
          "verification": {}
        },
        "mode": 420
      }
    ],
    "filesystems": [
      {
        "mount": {
          "device": "/dev/disk/by-label/OEM",
          "format": "btrfs"
        },
        "name": "OEM"
      }
    ]
    },
    "systemd": {}
    }
  4. Identify your USB drive (might be /dev/sdb)
  5. Run sudo ./flatcar-install -o "" -i config.json -B arm64-usr -C alpha -d <USB drive>

Boot

Insert the USB drive and SD card into the RPI4 and power-it up. Here is where there are a couple of tricky points:

jepio commented 3 years ago

Here's what I consider the nicer way, because you can do without the SD card but requires updating EEPROM and maybe modifying BOOT_ORDER EEPROM variable to boot from USB

The nice way

EEPROM

Update your EEPROM. I don't exactly know how this is best done, there are some files here: https://github.com/raspberrypi/rpi-eeprom/releases, you can also update with scripts from a running raspberrypi OS. BOOT_ORDER needs to be set to boot from USB.

USB

Prepare the USB stick following instructions from https://github.com/kinvolk/Flatcar/issues/502#issuecomment-916135250, but before booting mount p1 from the USB stick and unpack https://github.com/pftf/RPi4/releases/download/v1.28/RPi4_UEFI_Firmware_v1.28.zip into it. Unmount, insert into RPI4 and boot.

jepio commented 3 years ago

I would like us to provide rpi images on our servers, that have atleast the correct grub.cfg, and RPI4 UEFI firmware on the boot partition. With the right documentation people could then:

jepio commented 2 years ago

Started this work some time back on branches in scripts https://github.com/flatcar-linux/scripts/commits/jepio/rpi4 and coreos-overlay https://github.com/flatcar-linux/coreos-overlay/commits/jepio/rpi4. If someone wants to pick that up that, they are welcome to. Here are the todos that I can still remember:

tormath1 commented 2 years ago

We can close this is issue now - RPI 4 documentation is available here: https://www.flatcar.org/docs/latest/installing/bare-metal/raspberry-pi/ :rocket:

pothos commented 2 years ago

I think we still wanted to generate the OEM images with the firmware, or?