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

Prefix DEVICE_SERIAL_STORE, to match the docs #35

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config_app.helper
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ RPI_DEVICE_FAMILY|Mandatory|Specify the family of Raspberry Pi device you are pr
RPI_DEVICE_BOOTLOADER_CONFIG_FILE|Mandatory, with a default|Warning: rpi-sb-provisioner will ignore the Raspberry Pi Bootloader configuration built by pi-gen, and use the one provided in this variable. Specify the Raspberry Pi Bootloader configuration you want your provisioned devices to use. A default is provided. Further information on the format of this configuration file can be found in the Raspberry Pi Documentation, at https://www.raspberrypi.com/documentation/computers/config_txt.html
RPI_DEVICE_LOCK_JTAG|Optional|Raspberry Pi devices have a mechanism to restrict JTAG access to the device. Note that using this function will prevent Raspberry Pi engineers from being able to assist in debugging your device, should you request assitance. Set to any value to enable the JTAG restrictions.
RPI_DEVICE_EEPROM_WP_SET|Optional|Raspberry Pi devices that use an EEPROM as part of their boot flow can configure that EEPROM to enable write protection - preventing modification. Set to any value to enable EEPROM write protection.
DEVICE_SERIAL_STORE|Optional, with a default|Specify a location for the seen-devices storage directory. This directory will contain a zero-length file named with the serial number of each device seen, with the created files being used inside the state machine of rpi-sb-provisioner
RPI_DEVICE_SERIAL_STORE|Optional, with a default|Specify a location for the seen-devices storage directory. This directory will contain a zero-length file named with the serial number of each device seen, with the created files being used inside the state machine of rpi-sb-provisioner
RPI_SB_WORKDIR|Optional|Warning - If you do not set this variable, your modified OS intermediates will not be stored, and will be unavailable for inspection. Set to a location to cache OS assets between provisioning sessions. Recommended for use in production. For example: /srv/rpi-sb-provisioner/
DEMO_MODE_ONLY|Optional|Set to 1 to allow the service to run without actually writing keys or OS images. You may, for example, use DEMO_MODE_ONLY in combination with RPI_SB_WORKDIR to inspect the modifications rpi-sb-provisioner would make to your OS ahead of deployment. Warning - Setting DEMO_MODE_ONLY will cause your seen-devices storage location to change to a subdirectory of the one specified by RPI_DEVICE_SERIAL_STORE, demo/
2 changes: 1 addition & 1 deletion config/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def validate_RPI_DEVICE_LOCK_JTAG(text) -> tuple[bool, str]:
def validate_RPI_DEVICE_EEPROM_WP_SET(text) -> tuple[bool, str]:
return (True, "")

def validate_DEVICE_SERIAL_STORE(text) -> tuple[bool, str]:
def validate_RPI_DEVICE_SERIAL_STORE(text) -> tuple[bool, str]:
if text[0] == "/":
pass
else:
Expand Down
12 changes: 6 additions & 6 deletions device-triage/triage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ read_config
TARGET_DEVICE_SERIAL="$(udevadm info --name="$1" --query=property --property=ID_SERIAL_SHORT --value)"
echo "Starting triage for $1, serial: $TARGET_DEVICE_SERIAL"

if [ -z "${DEVICE_SERIAL_STORE}" ]; then
DEVICE_SERIAL_STORE=/usr/local/etc/rpi-sb-provisioner/seen
if [ -z "${RPI_DEVICE_SERIAL_STORE}" ]; then
RPI_DEVICE_SERIAL_STORE=/usr/local/etc/rpi-sb-provisioner/seen
fi

if [ ! -d "${DEVICE_SERIAL_STORE}" ]; then
mkdir -p "${DEVICE_SERIAL_STORE}"
if [ ! -d "${RPI_DEVICE_SERIAL_STORE}" ]; then
mkdir -p "${RPI_DEVICE_SERIAL_STORE}"
fi

if [ -z "${RPI_DEVICE_BOOTLOADER_CONFIG_FILE}" ]; then
Expand All @@ -31,9 +31,9 @@ if [ -z "${TARGET_DEVICE_SERIAL}" ]; then
exit 1
fi

if [ -e "${DEVICE_SERIAL_STORE}/${TARGET_DEVICE_SERIAL}" ]; then
if [ -e "${RPI_DEVICE_SERIAL_STORE}/${TARGET_DEVICE_SERIAL}" ]; then
echo "Device already provisioned with the key, moving to write the image"
echo "If this is in error, delete ${DEVICE_SERIAL_STORE}/${TARGET_DEVICE_SERIAL}"
echo "If this is in error, delete ${RPI_DEVICE_SERIAL_STORE}/${TARGET_DEVICE_SERIAL}"

# Start the boot provisioner service
mkdir -p /var/log/rpi-sb-provisioner/"${TARGET_DEVICE_SERIAL}"/
Expand Down
2 changes: 1 addition & 1 deletion host-support/rpi-sb-provisioner
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ RPI_DEVICE_FAMILY=
RPI_DEVICE_BOOTLOADER_CONFIG_FILE=/var/lib/rpi-sb-provisioner/bootloader.config
RPI_DEVICE_LOCK_JTAG=
RPI_DEVICE_EEPROM_WP_SET=
DEVICE_SERIAL_STORE=/usr/local/etc/rpi-sb-provisioner/seen
RPI_DEVICE_SERIAL_STORE=/usr/local/etc/rpi-sb-provisioner/seen
DEMO_MODE_ONLY=
RPI_SB_WORKDIR=
6 changes: 3 additions & 3 deletions key-writer/keywriter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fi
mkdir -p "/var/log/rpi-sb-provisioner/${TARGET_DEVICE_SERIAL}/metadata/"
[ -z "${DEMO_MODE_ONLY}" ] && rpiboot -d "${FLASHING_DIR}" -i "${TARGET_DEVICE_SERIAL}" -j "/var/log/rpi-sb-provisioner/${TARGET_DEVICE_SERIAL}/metadata/"

touch "${DEVICE_SERIAL_STORE}/${TARGET_DEVICE_SERIAL}"
touch "${RPI_DEVICE_SERIAL_STORE}/${TARGET_DEVICE_SERIAL}"

USER_BOARDREV="0x$(cat /var/log/rpi-sb-provisioner/${TARGET_DEVICE_SERIAL}/metadata/${TARGET_DEVICE_SERIAL}.json | jq -r '.USER_BOARDREV')"
MAC_ADDRESS=$(cat /var/log/rpi-sb-provisioner/${TARGET_DEVICE_SERIAL}/metadata/${TARGET_DEVICE_SERIAL}.json | jq -r '.MAC_ADDR')
Expand Down Expand Up @@ -272,5 +272,5 @@ esac
echo "Board is: ${BOARD_STR}, with revision number ${REVISION}. Has Processor ${PROCESSOR_STR} with Memory ${MEMORY_STR}. Was manufactured by ${MANUFACTURER_STR}"
echo "Keywriting completed. Rebooting for next phase."

mkdir -p /var/log/rpi-sb-provisioner/${TARGET_DEVICE_SERIAL}/
echo "KEYWRITER-FINISHED" >> /var/log/rpi-sb-provisioner/${TARGET_DEVICE_SERIAL}/progress
mkdir -p /var/log/rpi-sb-provisioner/"${TARGET_DEVICE_SERIAL}"/
echo "KEYWRITER-FINISHED" >> /var/log/rpi-sb-provisioner/"${TARGET_DEVICE_SERIAL}"/progress