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

[RFE] Provide RaspberryPi 4 images #502

Open
jepio opened this issue Sep 9, 2021 · 6 comments
Open

[RFE] Provide RaspberryPi 4 images #502

jepio opened this issue Sep 9, 2021 · 6 comments

Comments

@jepio
Copy link
Member

jepio commented Sep 9, 2021

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
Copy link
Member Author

jepio commented Sep 9, 2021

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": {}
}
  1. Identify your USB drive (might be /dev/sdb)
  2. 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:

  • on first boot the image only logs to the serial console, not HDMI, which requires a dedicated cable. Subsequent boots log on both consoles
  • if you dont have a screen, you need to know what IP address your PI gets through some other method
  • the default UEFI firmware is setup to only expose a max of 3GB RAM due to compatibility with other OSes. This can be changed in firmware setup (F1) but requires either a serial cable or HDMI+keyboard.

@jepio
Copy link
Member Author

jepio commented Sep 9, 2021

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 #502 (comment), 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
Copy link
Member Author

jepio commented Sep 9, 2021

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:

  • update EEPROM, and boot from USB
  • clone the boot partition onto an SD card and boot from SD

@jepio
Copy link
Member Author

jepio commented Jan 27, 2022

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:

  • document usage
  • figure out what to do about RAM limit (UEFI firmware has a default limit of 3GB RAM exposed to OS). Either recompile (more ebuild work), or figure out how to automate runtime switch
  • SD card support was not working

@tormath1
Copy link
Contributor

tormath1 commented Jul 8, 2022

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

@tormath1 tormath1 closed this as completed Jul 8, 2022
@pothos
Copy link
Member

pothos commented Jul 8, 2022

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

@tormath1 tormath1 reopened this Jul 8, 2022
@pothos pothos changed the title [RFE] Provide RaspberryPi 4 images with documentation [RFE] Provide RaspberryPi 4 images Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants