Skip to content

Commit

Permalink
initial os-release-ner implementation, and defconfig checklist (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 authored Mar 28, 2024
1 parent 31258a6 commit d6b9572
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 3 deletions.
7 changes: 7 additions & 0 deletions odysseus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ See below to learn more about developing, and check confluence for most info. O
2. Make any customizations you want in the menu
3. Save changes after you've made them by running ```make savedefconfig```. Ensure you are saving changes to the intended defconfig, it is saved to whatever directory you `cd`ed into!

#### Adding defconfigs

Checklist when adding a defconfig:
[ ] Add a secret for SSH password in settings, and load it into the workflow env in `.github/workflows/build_image.yml`
[ ] Add the defconfig itself, changing path names, etc. Board folders and overlays can still be shared as needed.
[ ] Add a pretty name to `post-build-os-release.sh`
[ ] Add a load command to `setup_env.sh`

<!--
## Build locally
Expand Down
1 change: 1 addition & 0 deletions odysseus/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
- ./odysseus_tree:/home/odysseus/build/odysseus_tree
- shared_data:/home/odysseus/shared_data
- ./outputs:/home/odysseus/outputs
- ../.git:/home/odysseus/build/githistory/.git:ro # read only as this is an unsafe operation
environment:
- BR2_DL_DIR=/home/odysseus/shared_data/dl
- BR2_CCACHE_DIR=/home/odysseus/shared_data/ccache
Expand Down
3 changes: 2 additions & 1 deletion odysseus/odysseus_tree/configs/raspberrypi3_64_ap_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="$(ODY_AP_ROOT_PASSWORD)"
# BR2_TARGET_GENERIC_GETTY is not set
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_nrc_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_ap"
BR2_ROOTFS_PRE_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/pre-make-ap.sh"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3-64/post-build.sh"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-os-release.sh board/raspberrypi3-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="AP"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,e755aa122bda2a684476d047d21f6c5aac15f21c)/linux-e755aa122bda2a684476d047d21f6c5aac15f21c.tar.gz"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="$(ODY_IROH_ROOT_PASSWORD)"
BR2_TARGET_TZ_INFO=y
BR2_TARGET_LOCALTIME="America/New_York"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_iroh"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3-64/post-build.sh"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-os-release.sh board/raspberrypi3-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="IROH"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,e755aa122bda2a684476d047d21f6c5aac15f21c)/linux-e755aa122bda2a684476d047d21f6c5aac15f21c.tar.gz"
Expand Down
3 changes: 2 additions & 1 deletion odysseus/odysseus_tree/configs/raspberrypi4_64_tpu_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ BR2_TARGET_TZ_INFO=y
BR2_TARGET_LOCALTIME="America/New_York"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_nrc_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_tpu"
BR2_ROOTFS_PRE_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/pre-make-sta.sh"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4-64/post-build.sh"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-os-release.sh board/raspberrypi4-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4-64/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="TPU"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,e755aa122bda2a684476d047d21f6c5aac15f21c)/linux-e755aa122bda2a684476d047d21f6c5aac15f21c.tar.gz"
Expand Down
62 changes: 62 additions & 0 deletions odysseus/odysseus_tree/post-build-os-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

FILE="$TARGET_DIR/etc/os-release-ody"

# if file exists, clear it
if test -f "$FILE";
then
rm "$FILE"
fi

# ensure file exists
touch "$FILE" || exit

# push a param to FILE, first arg is name second is value
push_param() {
cat <<< "$1=$2" >> "$FILE"
}

# change dirs for fetching git info
cd "$BR2_EXTERNAL_ODY_TREE_PATH"/../githistory/ || exit
# hacky way to allow portable git file to work
git config --global --add safe.directory $PWD

# https://www.freedesktop.org/software/systemd/man/latest/os-release.html#General%20information%20identifying%20the%20operating%20system
push_param "NAME" "NER Odysseus"
push_param "ID" "odysseus"
push_param "ID_LIKE" "buildroot"
push_param "PRETTY_NAME" "NER Odysseus v$(git describe --tags $(git rev-list --tags --max-count=1))"
# 2nd argument into this file is the name of the defconfig
if [[ "$2" == "TPU" ]];
then
variant="Built for Telemetry Processing Unit"
variantid="tpu"
elif [[ "$2" == "AP" ]];
then
variant="Built for HaLow Access Point"
variantid="ap"

elif [[ "$2" == "IROH" ]];
then
variant="Built for Iroh Charging Scraper"
variant="iroh"
else
variant="UK"
variantid="uk"
fi

push_param "VARIANT" "$variant"
push_param "VARIANT_ID" "$variantid"

# https://www.freedesktop.org/software/systemd/man/latest/os-release.html#Information%20about%20the%20version%20of%20the%20operating%20system
push_param "VERSION" "$(git describe --tags $(git rev-list --tags --max-count=1))" # latest tag
push_param "VERSION_ID" "$(git describe --tags $(git rev-list --tags --max-count=1))"
# VERSION_CODENAME unimplemented

push_param "BUILD_ID" "$(date +"%Y-%m-%dT%H:%M:%S%z")" # time of build finish
push_param "IMAGE_ID" "$(git rev-parse --abbrev-ref HEAD)" # branch name
push_param "IMAGE_VERSION" "$(git rev-parse HEAD)" # current sha

# https://www.freedesktop.org/software/systemd/man/latest/os-release.html#Presentation%20information%20and%20links
push_param "HOME_URL" "https://github.com/Northeastern-Electric-Racing/Odysseus"
push_param "VENDOR_NAME" "Northeastern Electric Racing"

0 comments on commit d6b9572

Please sign in to comment.