Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
image efi-part.vfat {
vfat {
file EFI {
image = "efi-part/EFI"
}
file grub-mender-grubenv {
image = "efi-part/grub-mender-grubenv"
}
file bzImage {
image = "bzImage"
}
}
size = 16M
}
image disk.img {
hdimage {
partition-table-type = "gpt"
}
partition boot {
partition-type-uuid = U
offset = 32K
image = "efi-part.vfat"
bootable = true
}
partition roota {
partition-type-uuid = 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
image = "rootfs.ext2"
}
partition rootb {
partition-type-uuid = 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
image = "rootfs.ext2"
}
partition data {
partition-type-uuid = L
image = "data-part.ext4"
}
}

View File

@@ -0,0 +1,64 @@
CONFIG_SYSVIPC=y
CONFIG_SMP=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_EFI=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_NETFILTER=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_FILTER=y
CONFIG_CFG80211=m
CONFIG_CFG80211_WEXT=y
CONFIG_MAC80211=m
CONFIG_PCI=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_SD=y
CONFIG_SCSI_VIRTIO=y
CONFIG_ATA=y
CONFIG_NETDEVICES=y
CONFIG_VIRTIO_NET=y
CONFIG_ATH9K=m
CONFIG_ATH9K_HTC=m
CONFIG_CARL9170=m
CONFIG_ATH10K=m
CONFIG_RT2X00=m
CONFIG_RT73USB=m
CONFIG_RT2800USB=m
CONFIG_RT2800USB_RT3573=y
CONFIG_RT2800USB_RT53XX=y
CONFIG_RT2800USB_RT55XX=y
# CONFIG_RTL_CARDS is not set
CONFIG_RTL8XXXU=m
CONFIG_INPUT_EVDEV=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_DRM=y
CONFIG_DRM_VIRTIO_GPU=y
CONFIG_FB_VESA=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_STORAGE=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_EXT4_FS=y
CONFIG_FUSE_FS=y
CONFIG_VFAT_FS=y
CONFIG_SQUASHFS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_UNWINDER_FRAME_POINTER=y

View File

@@ -0,0 +1,25 @@
################################################################################
# Mandatory
################################################################################
# Warning: This file is an example and should be customized to fit your needs!
# Partition index of root filesystem A
mender_rootfsa_part=2
# Partition index of root filesystem B
mender_rootfsb_part=3
# Device file corresponding to the root filesystem partitions, without index.
mender_kernel_root_base=/dev/vda
# Name of the storage device containing root filesystem partitions in GRUB
# format.
mender_grub_storage_device=hd0
# Type of kernel (bzImage or zImage)
kernel_imagetype=bzImage
# Type of initrd image.
# Note: An initrd image is not strictly necessary, and the system will boot and
# update without a initrd image.
# initrd_imagetype=initrd.img

View File

@@ -0,0 +1,7 @@
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext4 rw,noauto 0 1
/dev/vda1 /boot vfat defaults 0 0
/dev/vda4 /var/lib/mender ext4 rw,relatime 0 0
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0
sysfs /sys sysfs defaults 0 0

View File

@@ -0,0 +1,11 @@
{
"InventoryPollIntervalSeconds": 1800,
"UpdatePollIntervalSeconds": 1800,
"RetryPollIntervalSeconds": 300,
"RootfsPartA": "/dev/vda2",
"RootfsPartB": "/dev/vda3",
"ServerCertificate": "/etc/mender/server.crt",
"ServerURL": "https://docker.mender.io",
"TenantToken": "dummy",
"DeviceTypeFile": "/etc/mender/device_type"
}

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e
DEVICE_TYPE="buildroot-x86_64"
parse_args() {
local o O opts
o='a:o:d:'
O='artifact-name:,data-part-size:,device-type:'
opts="$(getopt -o "${o}" -l "${O}" -- "${@}")"
eval set -- "${opts}"
while [ ${#} -gt 0 ]; do
case "${1}" in
(-o|--data-part-size)
# Ignored to have same options as other scripts
shift 2
;;
(-d|--device-type)
DEVICE_TYPE="${2}"; shift 2
;;
(-a|--artifact-name)
# Ignored to have same options as other scripts
shift 2
;;
(--)
shift; break
;;
esac
done
}
# Create a persistent directory to mount the data partition at.
mender_fixup() {
pushd "${TARGET_DIR}"
# The common paradigm is to have the persistent data volume at /data for mender.
if [[ ! -L data ]]; then
ln -s var/lib/mender data
fi
popd
}
main() {
parse_args "${@}"
mender_fixup
echo "device_type=${DEVICE_TYPE}" > "${TARGET_DIR}/etc/mender/device_type"
}
main "${@}"

View File

@@ -0,0 +1,92 @@
#!/usr/bin/env bash
set -e
BOARD_DIR="$(realpath "$(dirname "$0")")"
DATA_PART="${BINARIES_DIR}"/data-part
DATA_PART_SIZE="32M"
DEVICE_TYPE="buildroot-x86_64"
ARTIFACT_NAME="1.0"
# Parse arguments.
parse_args() {
local o O opts
o='a:o:d:'
O='artifact-name:,data-part-size:,device-type:'
opts="$(getopt -o "${o}" -l "${O}" -- "${@}")"
eval set -- "${opts}"
while [ ${#} -gt 0 ]; do
case "${1}" in
(-o|--data-part-size)
DATA_PART_SIZE="${2}"; shift 2
;;
(-d|--device-type)
DEVICE_TYPE="${2}"; shift 2
;;
(-a|--artifact-name)
ARTIFACT_NAME="${2}"; shift 2
;;
(--)
shift; break
;;
esac
done
}
# Create the data partition
make_data_partition() {
"${HOST_DIR}/sbin/mkfs.ext4" \
-d "${DATA_PART}" \
-F \
-r 1 \
-N 0 \
-m 5 \
-L "data" \
"${BINARIES_DIR}/data-part.ext4" "${DATA_PART_SIZE}"
}
# Generate a mender bootstrap artifact.
# See https://github.com/mendersoftware/mender/blob/3.5.3/Documentation/automatic-bootstrap-artifact.md
generate_mender_bootstrap_artifact() {
rm -rf "${DATA_PART}"
mkdir -p "${DATA_PART}"
img_checksum=$(sha256sum "${BINARIES_DIR}"/rootfs.ext4 |awk '{print $1}')
"${HOST_DIR}"/bin/mender-artifact \
write bootstrap-artifact \
--compression none \
--artifact-name "${ARTIFACT_NAME}" \
--device-type "${DEVICE_TYPE}" \
--provides "rootfs-image.version:${ARTIFACT_NAME}" \
--provides "rootfs-image.checksum:${img_checksum}" \
--clears-provides "rootfs-image.*" \
--output-path "${DATA_PART}"/bootstrap.mender \
--version 3
}
# Create a mender image.
generate_mender_image() {
echo "Creating ${BINARIES_DIR}/${DEVICE_TYPE}-${ARTIFACT_NAME}.mender"
"${HOST_DIR}/bin/mender-artifact" \
write rootfs-image \
--compression none \
-t "${DEVICE_TYPE}" \
-n "${BR2_VERSION}" \
-f "${BINARIES_DIR}/rootfs.ext2" \
-o "${BINARIES_DIR}/${DEVICE_TYPE}-${ARTIFACT_NAME}.mender"
}
generate_image() {
support/scripts/genimage.sh -c "${BOARD_DIR}/genimage-efi.cfg"
}
# Main function.
main() {
parse_args "${@}"
generate_mender_bootstrap_artifact
make_data_partition
generate_image
generate_mender_image
exit $?
}
main "${@}"

View File

@@ -0,0 +1,69 @@
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 image
The build process will create a all-in-one image called disk.img in
output/images.
Write the image to a pendrive:
$ dd if=output/images/disk.img of=/dev/sdX; 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