From 49e0d2d7cf009450f77327283539707ee9df8efc Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Thu, 28 Mar 2024 17:05:27 -0400 Subject: [PATCH] Introduce macOS (partial) and Windows support (#125) * add debug defconfig, remove symlink * Update README.md * eol gitattr * add note about nanomq * misc nrc params fixes, nero debug update --- .gitattributes | 2 +- odysseus/README.md | 34 ++++++++++++++----- odysseus/compose-compat.yml | 27 +++++++++++++++ .../configs/raspberrypi3_64_ap_defconfig | 3 +- .../raspberrypi4_64_nero_debug_defconfig | 31 +++++++++++++++++ .../configs/raspberrypi4_64_tpu_defconfig | 3 +- .../rootfs_overlay_ap/etc/modprobe.d/nrc.conf | 1 - .../etc/modprobe.d/nrc.conf | 1 - odysseus/odysseus_tree/post-build-ap.sh | 3 ++ odysseus/odysseus_tree/post-build-sta.sh | 3 ++ odysseus/odysseus_tree/pre-make-ap.sh | 3 -- odysseus/odysseus_tree/pre-make-sta.sh | 3 -- .../odysseus_tree/utils/build_nrc_params.py | 1 - 13 files changed, 92 insertions(+), 23 deletions(-) create mode 100644 odysseus/compose-compat.yml create mode 100644 odysseus/odysseus_tree/configs/raspberrypi4_64_nero_debug_defconfig delete mode 100644 odysseus/odysseus_tree/overlays/rootfs_overlay_ap/etc/modprobe.d/nrc.conf delete mode 100644 odysseus/odysseus_tree/overlays/rootfs_overlay_tpu/etc/modprobe.d/nrc.conf create mode 100755 odysseus/odysseus_tree/post-build-ap.sh create mode 100755 odysseus/odysseus_tree/post-build-sta.sh delete mode 100755 odysseus/odysseus_tree/pre-make-ap.sh delete mode 100755 odysseus/odysseus_tree/pre-make-sta.sh delete mode 120000 odysseus/odysseus_tree/utils/build_nrc_params.py diff --git a/.gitattributes b/.gitattributes index f6e3b12b..6313b56c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -*.sh text eol=lf +* text=auto eol=lf diff --git a/odysseus/README.md b/odysseus/README.md index 6db2704f..b92aac84 100644 --- a/odysseus/README.md +++ b/odysseus/README.md @@ -27,24 +27,34 @@ All defconfigs come with (in addition to busybox and util_linux utilities): - iperf3, iw, iputils, and other network configuration utilities ## Quick start -Download and install to PATH git and docker. +Download and install to PATH git and docker. Docker desktop is recommended for macOS and Windows. ``` git clone https://github.com/Northeastern-Electric-Racing/Siren.git git submodule update --init --recursive cd ./odysseus ``` -At this point, copy the file `SECRETS.env-example` to `SECRETS.env`, if you want to use non-default passwords edit this file. -Once that is done, run: +For linux (current support includes all build defconfigs): ``` docker compose run --rm --build odysseus # Future launches can omit `--build` for time savings and space savings, but it should be used if the Dockerfile or docker_out_of_tree.sh files change. + +``` + +For mac and windows: (current support includes all _debug defconfigs, on x86_64 host normal defconfigs can work (experimental)): ``` +docker compose -f "compose-compat.yml" run --rm --build odysseus # Future launches can omit `--build` for time savings and space savings, but it should be used if the Dockerfile or docker_out_of_tree.sh files change. +``` + + + Now you are in the docker container. To build cd into the defconfig directory (either ap, or tpu), then run the make command alias: ``` cd ./ make-current ``` -You can view the `output.log` for more info. Now, to deploy just flash the image in `images/ + +**Note: If failure occurs on mac or windows very early in the process, run `make nanomq-source` and try again before reporting the error.** +You can view the `output.log` for more info. ### More on docker configuration The container has a directory structure as so: @@ -54,13 +64,16 @@ The container has a directory structure as so: - `./odysseus_tree`: The odyssues external tree, bound to the same directory in the git repository on your local machine! - `./shared_data`: The download and ccache cache for buildroot, should be persisted as long as space is available, there is usually no reason to enter this. A persistent docker volume with the name `odysseus_shared_data`. - `./outputs/*`: - - **The output folders for odysseus. `cd` into the one named for what defconfig you would like to build, and run the `make` configuration and build commands as described below. It is recommended to save space to run `make clean` in defconfig directories rather than removing this volume all together. This is bound to the `./odysseus/outputs` directory in the repository. *Remember to use `make savedefconfig` when you are done as changes are overriden when you re-open the docker image!* + - **The output folders for odysseus. `cd` into the one named for what defconfig you would like to build, and run the `make` configuration and build commands as described below. It is recommended to save space to run `make clean` in defconfig directories rather than removing this volume all together. For Linux hosts, this is bound to the `./odysseus/outputs` directory in the repository. For Windows users, this is a docker volume. *Remember to use `make savedefconfig` when you are done as changes are overriden when you re-open the docker image!* ### Extra docker tips All paths relative to Siren root. +#### Note for Windows/macOS users +The outputs are stored in a docker volume on these platforms to ensure rsync compatability. Therefore fetching the files requires first running the image, then use `docker cp` to get them to the userspace. Alternatively, docker desktop has a file explorer for docker volumes that may come in handy. + #### Writing the sd card -The image is present in `./odysseus/outputs//images/sdcard.img`. +The image is present in `./odysseus/outputs//images/sdcard.img`. One can flash this with tools like the Raspberry Pi OS Imager. #### Pulling source files for scp, etc. The target binaries are located in `./odysseus/outputs//target`. @@ -71,6 +84,10 @@ The target binaries are located in `./odysseus/outputs//target`. **IMPORTANT**: this WILL wipe all shared cache (don't do this unless you need the space): `docker volume rm odysseus_shared_data` +This will wipe all outputs, not the cache so just requires a full rebuild to recover from. On compose-compat images only: +`docker volume rm odysseus_outputs` + + #### Open another tty `docker ps` Find the container ID of odysseus-odysseus then run: @@ -83,9 +100,8 @@ docker exec -d -w /home/odysseus/outputs/ make-current ``` Be careful with this. -Notes about docker: -- Build time may be slower due to docker isolations (not dramatic, about 5-15%) -- Since odysseus only supports amd64 hosts for non-debug defconfigs, full releases cannot be built on mac +Docker limitations: +- Build time may be slower due to docker isolations (not dramatic, about 5%) - Launch time is longer - Space is used up by rebuilds, prune often or omit `--build` diff --git a/odysseus/compose-compat.yml b/odysseus/compose-compat.yml new file mode 100644 index 00000000..aff6bd9f --- /dev/null +++ b/odysseus/compose-compat.yml @@ -0,0 +1,27 @@ +version: "3.8" +services: + odysseus: + build: . + command: /bin/bash + privileged: true + tty: true + # for fakeroot failure + ulimits: + nofile: + soft: 1024 + hard: 1048576 + volumes: + - ./odysseus_tree:/home/odysseus/build/odysseus_tree + - shared_data:/home/odysseus/shared_data + - outputs:/home/odysseus/outputs + environment: + - BR2_DL_DIR=/home/odysseus/shared_data/dl + - BR2_CCACHE_DIR=/home/odysseus/shared_data/ccache +volumes: + # required for mac as no hard linking:( + outputs: + labels: + com.northeastern_electric_racing.description: "Buildroot outputs, including disk images" + shared_data: + labels: + com.northeastern_electric_racing.description: "Shared output between buildroot runs" diff --git a/odysseus/odysseus_tree/configs/raspberrypi3_64_ap_defconfig b/odysseus/odysseus_tree/configs/raspberrypi3_64_ap_defconfig index ba4971ce..75a419a0 100644 --- a/odysseus/odysseus_tree/configs/raspberrypi3_64_ap_defconfig +++ b/odysseus/odysseus_tree/configs/raspberrypi3_64_ap_defconfig @@ -9,8 +9,7 @@ BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y 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="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-os-release.sh board/raspberrypi3-64/post-build.sh" +BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-ap.sh $(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 diff --git a/odysseus/odysseus_tree/configs/raspberrypi4_64_nero_debug_defconfig b/odysseus/odysseus_tree/configs/raspberrypi4_64_nero_debug_defconfig new file mode 100644 index 00000000..f5acfdaa --- /dev/null +++ b/odysseus/odysseus_tree/configs/raspberrypi4_64_nero_debug_defconfig @@ -0,0 +1,31 @@ +BR2_aarch64=y +BR2_cortex_a72=y +BR2_ARM_FPU_VFPV4=y +BR2_TOOLCHAIN_BUILDROOT_CXX=y +BR2_CCACHE=y +BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_ODY_TREE_PATH)/patches" +BR2_PER_PACKAGE_DIRECTORIES=y +BR2_PACKAGE_DEJAVU=y +# BR2_PACKAGE_DEJAVU_SANS is not set +# BR2_PACKAGE_DEJAVU_SERIF is not set +# BR2_PACKAGE_DEJAVU_SANS_CONDENSED is not set +# BR2_PACKAGE_DEJAVU_SERIF_CONDENSED is not set +BR2_PACKAGE_KMSCUBE=y +BR2_PACKAGE_MESA3D=y +BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D=y +BR2_PACKAGE_MESA3D_OPENGL_ES=y +BR2_PACKAGE_NERO2=y +BR2_PACKAGE_NERQT6=y +BR2_PACKAGE_NERQT6BASE_EGLFS=y +BR2_PACKAGE_NERQT6BASE_DEFAULT_QPA="eglfs" +BR2_PACKAGE_NERQT6BASE_JPEG=y +BR2_PACKAGE_NERQT6BASE_PNG=y +BR2_PACKAGE_NERQT6BASE_WIDGETS=y +BR2_PACKAGE_NERQT6BASE_NETWORK=y +BR2_PACKAGE_NERQT6BASE_SYSLOG=y +BR2_PACKAGE_NERQT6CORE5COMPAT=y +BR2_PACKAGE_NERQT6SVG=y +BR2_PACKAGE_NERQT6DECLARATIVE=y +BR2_PACKAGE_NERQT6DECLARATIVE_QUICK=y +BR2_PACKAGE_NERQT6MQTT=y +BR2_PACKAGE_NERQT6GRPC=y diff --git a/odysseus/odysseus_tree/configs/raspberrypi4_64_tpu_defconfig b/odysseus/odysseus_tree/configs/raspberrypi4_64_tpu_defconfig index 4141879d..f0c97865 100644 --- a/odysseus/odysseus_tree/configs/raspberrypi4_64_tpu_defconfig +++ b/odysseus/odysseus_tree/configs/raspberrypi4_64_tpu_defconfig @@ -12,8 +12,7 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="$(ODY_TPU_ROOT_PASSWORD)" 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="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-os-release.sh board/raspberrypi4-64/post-build.sh" +BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-sta.sh $(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 diff --git a/odysseus/odysseus_tree/overlays/rootfs_overlay_ap/etc/modprobe.d/nrc.conf b/odysseus/odysseus_tree/overlays/rootfs_overlay_ap/etc/modprobe.d/nrc.conf deleted file mode 100644 index 71b01fd9..00000000 --- a/odysseus/odysseus_tree/overlays/rootfs_overlay_ap/etc/modprobe.d/nrc.conf +++ /dev/null @@ -1 +0,0 @@ -options nrc fw_name=nrc7292_cspi.bin bss_max_idle=1800 ndp_preq=1 listen_interval=1000 bd_name=nrc7292_bd.dat ap_rc_mode=2 sta_rc_mode=2 ap_rc_default_mcs=2 sta_rc_default_mcs=2 diff --git a/odysseus/odysseus_tree/overlays/rootfs_overlay_tpu/etc/modprobe.d/nrc.conf b/odysseus/odysseus_tree/overlays/rootfs_overlay_tpu/etc/modprobe.d/nrc.conf deleted file mode 100644 index 755c361f..00000000 --- a/odysseus/odysseus_tree/overlays/rootfs_overlay_tpu/etc/modprobe.d/nrc.conf +++ /dev/null @@ -1 +0,0 @@ -options nrc fw_name=nrc7292_cspi.bin bss_max_idle=1800 listen_interval=1000 bd_name=nrc7292_bd.dat ap_rc_mode=2 sta_rc_mode=2 ap_rc_default_mcs=2 sta_rc_default_mcs=2 diff --git a/odysseus/odysseus_tree/post-build-ap.sh b/odysseus/odysseus_tree/post-build-ap.sh new file mode 100755 index 00000000..1feb31ac --- /dev/null +++ b/odysseus/odysseus_tree/post-build-ap.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +python3 "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_nrc_common/usr/bin/build_nrc_params.py 1 "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_ap/etc/nrc_opts_ap.ini "$TARGET_DIR"/etc/modprobe.d/nrc.conf diff --git a/odysseus/odysseus_tree/post-build-sta.sh b/odysseus/odysseus_tree/post-build-sta.sh new file mode 100755 index 00000000..95c3b6b3 --- /dev/null +++ b/odysseus/odysseus_tree/post-build-sta.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +python3 "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_nrc_common/usr/bin/build_nrc_params.py 0 "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_tpu/etc/nrc_opts_sta.ini "$TARGET_DIR"/etc/modprobe.d/nrc.conf diff --git a/odysseus/odysseus_tree/pre-make-ap.sh b/odysseus/odysseus_tree/pre-make-ap.sh deleted file mode 100755 index 88e4cea3..00000000 --- a/odysseus/odysseus_tree/pre-make-ap.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -python3 "$BR2_EXTERNAL_ODY_TREE_PATH"/utils/build_nrc_params.py 1 "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_ap/etc/nrc_opts_ap.ini "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_ap/etc/modprobe.d/nrc.conf diff --git a/odysseus/odysseus_tree/pre-make-sta.sh b/odysseus/odysseus_tree/pre-make-sta.sh deleted file mode 100755 index 72779397..00000000 --- a/odysseus/odysseus_tree/pre-make-sta.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -python3 "$BR2_EXTERNAL_ODY_TREE_PATH"/utils/build_nrc_params.py 0 "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_tpu/etc/nrc_opts_sta.ini "$BR2_EXTERNAL_ODY_TREE_PATH"/overlays/rootfs_overlay_tpu/etc/modprobe.d/nrc.conf diff --git a/odysseus/odysseus_tree/utils/build_nrc_params.py b/odysseus/odysseus_tree/utils/build_nrc_params.py deleted file mode 120000 index 4c21eb76..00000000 --- a/odysseus/odysseus_tree/utils/build_nrc_params.py +++ /dev/null @@ -1 +0,0 @@ -../overlays/rootfs_overlay_nrc_common/usr/bin/build_nrc_params.py \ No newline at end of file