diff --git a/.readthedocs.yaml b/.readthedocs.yaml index efc352ca79..c86005adf1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -6,7 +6,7 @@ version: 2 # Set the OS, Python version and other tools you might need build: - os: ubuntu-24.04 + os: ubuntu-26.04 tools: python: "3.12" diff --git a/Dockerfile b/Dockerfile index d533dac4d9..2853b1f43e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,19 @@ # Target with dependencies and the binaries to run the complete flow -FROM openroad/flow-dev +FROM openroad/flow-ubuntu26.04-dev:latest WORKDIR /OpenROAD-flow-scripts -# synthesis tools binaries and plugins -COPY --from=openroad/yosys /install ./tools/install/yosys +# Flow tools built for the same Ubuntu release as the runtime image. +COPY --from=openroad/flow-ubuntu26.04-tools:latest \ + /OpenROAD-flow-scripts/tools/install ./tools/install -# openroad binary -COPY --from=openroad/ubuntu22.04-builder-gcc \ - /OpenROAD/install/bin/openroad \ - ./tools/install/OpenROAD/bin/openroad +# OpenROAD binary and its installed libraries. +COPY --from=openroad/ubuntu26.04:latest \ + /OpenROAD/install ./tools/install/OpenROAD # flow files COPY ./env.sh . COPY ./flow ./flow -# avoid issues with permissions -RUN chmod o+rw -R /OpenROAD-flow-scripts +# Allow users of the image to write flow results. +RUN chmod -R a+rwX /OpenROAD-flow-scripts/flow diff --git a/docker/Dockerfile.builder b/docker/Dockerfile.builder index 3673cfb649..3b72530b9b 100644 --- a/docker/Dockerfile.builder +++ b/docker/Dockerfile.builder @@ -5,7 +5,7 @@ # NOTE: don't use this file directly unless you know what you are doing, # instead use etc/DockerHelper.sh -ARG fromImage=openroad/flow-ubuntu22.04-dev:latest +ARG fromImage=openroad/flow-ubuntu26.04-dev:latest # Image holding the prebuilt tools/install of every tool except OpenROAD # (a build of the orfs-tools target). By default they are built here. ARG toolsImage=orfs-tools diff --git a/docker/Dockerfile.claude b/docker/Dockerfile.claude index 3238c252df..b6c62bb207 100644 --- a/docker/Dockerfile.claude +++ b/docker/Dockerfile.claude @@ -3,7 +3,7 @@ # # Usage: see claude.sh at the repo root. -ARG fromImage=openroad/flow-ubuntu22.04-dev:latest +ARG fromImage=openroad/flow-ubuntu26.04-dev:latest FROM ${fromImage} diff --git a/docker/claude-entrypoint.sh b/docker/claude-entrypoint.sh index 28280421eb..6e6dcc3d98 100755 --- a/docker/claude-entrypoint.sh +++ b/docker/claude-entrypoint.sh @@ -23,7 +23,6 @@ if [ -n "${HOST_UID}" ] && [ -n "${HOST_GID}" ]; then # Create user (reuse existing if UID is taken) if ! getent passwd "${HOST_UID}" > /dev/null 2>&1; then - mkdir -p "${USER_HOME}" useradd \ --uid "${HOST_UID}" \ --gid "${HOST_GID}" \ @@ -34,15 +33,18 @@ if [ -n "${HOST_UID}" ] && [ -n "${HOST_GID}" ]; then "${USER_NAME}" else USER_NAME=$(getent passwd "${HOST_UID}" | cut -d: -f1) - USER_HOME=$(getent passwd "${HOST_UID}" | cut -d: -f6) + usermod --home "${USER_HOME}" "${USER_NAME}" fi # Passwordless sudo echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/claude-user chmod 0440 /etc/sudoers.d/claude-user + # The engine creates .cache as root when it mounts .cache/bazel. + # Bazelisk writes to .cache/bazelisk, so the user owns .cache too. + mkdir -p "${USER_HOME}/.cache" export HOME="${USER_HOME}" - chown "${HOST_UID}:${HOST_GID}" "${USER_HOME}" + chown "${HOST_UID}:${HOST_GID}" "${USER_HOME}" "${USER_HOME}/.cache" touch "${USER_HOME}/.hushlogin" # Set up ORFS environment (PATH to tools, FLOW_HOME, etc.) diff --git a/docker/test-claude-entrypoint.sh b/docker/test-claude-entrypoint.sh new file mode 100644 index 0000000000..900a1d6923 --- /dev/null +++ b/docker/test-claude-entrypoint.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [[ "${1:-}" == --assert ]]; then + if [[ "${HOME}" != /home/claude-user ]]; then + echo "HOME=${HOME}, expected /home/claude-user" >&2 + exit 1 + fi + test "$(id -u)" = "$2" + account_home=$(getent passwd "$2" | cut -d: -f6) + if [[ "${account_home}" != "${HOME}" ]]; then + echo "Account home=${account_home}, HOME=${HOME}" >&2 + exit 1 + fi + test "$(cat "${HOME}/.claude/settings.json")" = fixture + echo updated > "${HOME}/.claude/settings.json" + # Bazelisk downloads Bazel into ~/.cache/bazelisk. + mkdir "${HOME}/.cache/bazelisk" + echo "UID $2 reads and writes settings through HOME" + echo "UID $2 creates ~/.cache/bazelisk next to the mounted Bazel cache" + exit 0 +fi + +if [[ "${1:-}" == --inside ]]; then + uid=$2 + gid=$3 + if [[ "$4" == existing ]]; then + getent passwd "${uid}" > /dev/null + mkdir -p "$(getent passwd "${uid}" | cut -d: -f6)" + else + if getent passwd "${uid}" > /dev/null; then + echo "Fixture UID ${uid} must be unused" >&2 + exit 1 + fi + fi + mkdir -p /home/claude-user/.claude /etc/sudoers.d + echo fixture > /home/claude-user/.claude/settings.json + chown -R "${uid}:${gid}" /home/claude-user/.claude + # claude.sh mounts the Bazel cache here; the engine leaves .cache owned by root. + mkdir -p /home/claude-user/.cache/bazel + chown "${uid}:${gid}" /home/claude-user/.cache/bazel + export HOST_UID=${uid} HOST_GID=${gid} + exec bash /test/claude-entrypoint.sh bash /test/test-claude-entrypoint.sh --assert "${uid}" +fi + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}" +TEST_IMAGE="${TEST_IMAGE:-openroad/flow-ubuntu26.04-dev:latest}" + +for fixture in '1000 1000 existing' '2000 2000 new'; do + read -r uid gid state <<< "${fixture}" + "${CONTAINER_ENGINE}" run --rm --platform linux/amd64 \ + --network none --user 0:0 \ + --cap-drop ALL --cap-add CHOWN --cap-add SETUID --cap-add SETGID --cap-add DAC_OVERRIDE \ + --security-opt no-new-privileges \ + --cpus 2 --memory 4g --pids-limit 256 \ + --volume "${SCRIPT_DIR}:/test:ro" \ + --entrypoint bash "${TEST_IMAGE}" \ + /test/test-claude-entrypoint.sh --inside "${uid}" "${gid}" "${state}" +done diff --git a/docs/user/BuildLocally.md b/docs/user/BuildLocally.md index 1d58c82b69..b537c6ea72 100644 --- a/docs/user/BuildLocally.md +++ b/docs/user/BuildLocally.md @@ -36,7 +36,7 @@ up the environment. The `make` command runs from RTL-GDSII generation for defaul ``` shell source ./env.sh yosys -help -yosys -m slang -p "slang_version" +yosys -p "slang_version" openroad -help cd flow make diff --git a/docs/user/BuildWithDocker.md b/docs/user/BuildWithDocker.md index c0fb049284..8b266264c8 100644 --- a/docs/user/BuildWithDocker.md +++ b/docs/user/BuildWithDocker.md @@ -42,13 +42,20 @@ You can start the container in an interactive mode using the command below. ```shell -docker run -it ubuntu:22.04 +docker run -it ubuntu:26.04 ``` Now you are ready to install the prebuilt binaries. Please refer to the instructions for installing prebuilt binaries [here](./BuildWithPrebuilt.md). +The root `Dockerfile` assembles a runtime image from the published Ubuntu 26.04 development image, flow tools, and OpenROAD installation. +Build it without compiling the tools: + +```shell +docker build -t openroad/orfs-local . +``` + ### Build Using Docker from sources Alternatively, if you would like the latest commits from the OpenROAD repositories, @@ -85,7 +92,7 @@ Then, inside docker: ``` shell source ./env.sh yosys -help -yosys -m slang -p "slang_version" +yosys -p "slang_version" openroad -help cd flow make diff --git a/docs/user/BuildWithPrebuilt.md b/docs/user/BuildWithPrebuilt.md index c21c0c0999..394f6f5fd1 100644 --- a/docs/user/BuildWithPrebuilt.md +++ b/docs/user/BuildWithPrebuilt.md @@ -17,7 +17,7 @@ from [OpenROAD VaultLink](https://vaultlink.precisioninno.com/). Thanks to [Precision Innovations](https://precisioninno.com/) for hosting and maintaining these binaries. Pre-built binaries are available for these platforms: -- Ubuntu 22.04 +- Ubuntu 26.04 - Ubuntu 24.04 Use the following steps to download: @@ -27,10 +27,10 @@ Step 1: Open [OpenROAD VaultLink](https://vaultlink.precisioninno.com/). Step 2: Download the `.deb` package for your Ubuntu version. Step 3: Install the package with `apt`. - For example, on Ubuntu 22.04: + For example, on Ubuntu 26.04: ```shell -sudo apt install ./openroad__amd64-ubuntu-22.04.deb +sudo apt install ./openroad__amd64-ubuntu-26.04.deb ``` ## Verify Installation @@ -48,7 +48,7 @@ export OPENROAD_EXE=$(command -v openroad) export YOSYS_EXE=$(command -v yosys) yosys -help -yosys -m slang -p "slang_version" +yosys -p "slang_version" openroad -help cd flow make diff --git a/docs/user/ClaudeCode.md b/docs/user/ClaudeCode.md index 251bdc68e5..81f71d0fa2 100644 --- a/docs/user/ClaudeCode.md +++ b/docs/user/ClaudeCode.md @@ -117,7 +117,7 @@ The setup consists of three files: ### `docker/Dockerfile.claude` -Extends the `openroad/flow-ubuntu22.04-dev` base image (which has all +Extends the `openroad/flow-ubuntu26.04-dev` base image (which has all OpenROAD build dependencies) with: - Java 21 and Bazelisk (for Bazel 8.x builds) @@ -136,8 +136,25 @@ correct ownership on the host. The entrypoint: 2. Sources `env.sh` to set up tool paths, from the start directory if it has one, else from `/workspace` 3. Drops privileges via `setpriv` before running the command -This follows the same pattern as `tools/OpenROAD/etc/docker-entrypoint.sh` -and the `--user` mode in `flow/util/docker_shell`. +The mapped user's account record and `HOME` both use `/home/claude-user`. +This keeps the settings and cache mounts visible when the base image already has an account with the host UID. + +Run the entrypoint regression check in disposable containers: + +```shell +bash docker/test-claude-entrypoint.sh +``` + +With Podman: + +```shell +CONTAINER_ENGINE=podman bash docker/test-claude-entrypoint.sh +``` + +The check covers an existing UID and a new UID. +It verifies that the launched command can read and write fixture settings through `HOME`. +It also checks that the account's recorded home matches `HOME`. +It also checks that the user can create `~/.cache/bazelisk` beside the mounted Bazel cache. ### `claude.sh`