kumquat-buildroot/board/mender/x86_64
Adam Duskett 71cc399259 board/mender: add a mender board example configuration.
Buildroot currently has all of the needed packages to use Mender as the primary
update system. However, there isn't any documentation or examples now that
provide a starting point for users. This lack of documentation makes setting up
a Mender based update system difficult and time-consuming.

Provided in this patch series is a mender_x86_64_efi_defconfig of which sets up
an x86_64 EFI based build that is ready to flash to a USB pen drive or use in a
QEMU environment. The system partition schema comprises of two equally sized
root partitions and a data partition that mounts to /var/lib/mender as a
persistent data store partition.

There is a board/mender/readme.txt provided, which gives users documentation on
how to flash the built image or boot the image using QEMU as well.

The post-build and post-image-efi scripts also have four options:
-a --artifact-name:
  - The name of the artifact, this is added to /etc/mender/artifact_info
-o --data-part-size:
  - The data partition size.
-d --device-type
  - The device-type used by mender to catagorize registered devices.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Mikael Bourhis-Cloarec <mikael.bourhis@smile.fr>
[Romain: rebase on master (01.2022)
  - update genimage-efi.cfg to use GPT partition table and genimage-15 syntax
  - bump the kernel to 5.15.13
  - Add host-libelf kernel dependency
  - Use BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI after commit 82d1e8c628
    (boot/grub2: use none platform when building for host)
  - Add regexp grub mandatory module for mender-grubenv
  - remove startup.nsh from genimage-efi.cfg after commit 3efb5e31fc
    (board, boot, package: remove usage of startup.nsh in EFI partition)]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
[Arnout:
  - abbreviate sizes and partition uuids, remove implicit ones in genimage.cfg
  - change data partition uuid to Linux (instead of x86_64 rootfs)
  - fix whitespace and shellcheck errors in scripts
  - remove --generate-mender-image option, always create it
  - remove empty directory and -O ^64bit when creating data fs
  - remove redundant e2fsck
  - add -serial stdio option to qemu call
  - update kernel to current stable 5.18.14
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-07-24 21:04:38 +02:00
..
overlay/etc board/mender: add a mender board example configuration. 2022-07-24 21:04:38 +02:00
genimage-efi.cfg board/mender: add a mender board example configuration. 2022-07-24 21:04:38 +02:00
linux.config board/mender: add a mender board example configuration. 2022-07-24 21:04:38 +02:00
mender_grubenv_defines board/mender: add a mender board example configuration. 2022-07-24 21:04:38 +02:00
post-build.sh board/mender: add a mender board example configuration. 2022-07-24 21:04:38 +02:00
post-image-efi.sh board/mender: add a mender board example configuration. 2022-07-24 21:04:38 +02:00
readme.txt board/mender: add a mender board example configuration. 2022-07-24 21:04:38 +02:00

Mender UEFI PC sample config
=====================

1. Build

  $ make mender_x86_64_efi_defconfig

  Add any additional packages required. Update the files in board/mender/x86_64
  and change /dev/vda to what is relevant for your platform: typically
  /dev/mmcblk0p for eMMC and /dev/sda for USB or SATA.

  $ make

2. Write the Pendrive

  The build process will create a Pendrive image called disk.img in
  output/images.

  Write the image to a pendrive:

  $ dd if=output/images/disk.img of=/dev/${pendrive}; sync

  Once the process is complete, insert it into the target PC and boot.

  Remember that if said PC has another boot device you might need to
  select this alternative for it to boot.

  You might need to disable Secure Boot from the setup as well.

3. Enjoy

Emulation in qemu
========================

Run the emulation with:

qemu-system-x86_64 \
    -M pc \
    -drive file=output/images/disk.img,if=virtio,format=raw \
    -net nic,model=virtio \
    -net user \
    -serial stdio \
    -bios </path/to/OVMF_CODE.fd>

Note that </path/to/OVMF.fd> needs to point to a valid x86_64 UEFI
firmware image for qemu. It may be provided by your distribution as an
edk2 or OVMF package, in a path such as /usr/share/edk2/ovmf/OVMF_CODE.fd.

Optional arguments:
 - -enable-kvm to speed up qemu. This requires a loaded kvm module on the host
    system.
 - Add -smp N to emulate an SMP system with N CPUs.

The login prompt will appear in the serial window.

Tested with QEMU 4.1.1 on Fedora 31

Creating a mender-artifact
========================

The mender artifact is created in output/images/buildroot-x86_64-1.0.mender

You may wish to change --artifact-name=1.0 to a name that best suits your
particular needs, as this option changes the mender artifact name.

Using mender
========================
Please read the mender documentation at:
https://docs.mender.io/2.2/getting-started