From 96f9bbd904e4b60e9604e14a2d63a491719493e7 Mon Sep 17 00:00:00 2001 From: penguin Date: Sun, 22 Sep 2024 22:13:34 -0500 Subject: [PATCH] reverting back to mono container... --- microchip_tools/Dockerfile => Dockerfile | 44 ++++++++++++++----- Makefile | 28 ++++++++++++ microchip_license_server/Dockerfile | 37 ---------------- microchip_license_server/Makefile | 14 ------ microchip_license_server/scripts/entrypoint | 2 - microchip_license_server/scripts/env | 12 ----- microchip_tools/Makefile | 34 -------------- microchip_tools/scripts/env | 14 ------ scripts/env | 24 ++++++++++ .../scripts => scripts}/verify_installers | 0 10 files changed, 84 insertions(+), 125 deletions(-) rename microchip_tools/Dockerfile => Dockerfile (65%) create mode 100644 Makefile delete mode 100644 microchip_license_server/Dockerfile delete mode 100644 microchip_license_server/Makefile delete mode 100755 microchip_license_server/scripts/entrypoint delete mode 100755 microchip_license_server/scripts/env delete mode 100644 microchip_tools/Makefile delete mode 100755 microchip_tools/scripts/env create mode 100644 scripts/env rename {microchip_tools/scripts => scripts}/verify_installers (100%) diff --git a/microchip_tools/Dockerfile b/Dockerfile similarity index 65% rename from microchip_tools/Dockerfile rename to Dockerfile index 8ce0668..1b83970 100644 --- a/microchip_tools/Dockerfile +++ b/Dockerfile @@ -1,34 +1,50 @@ FROM ubuntu:22.04 +RUN useradd -r -s /sbin/nologin -c "Microchip tools" -m libby +USER root + ENV LIBERO_VERSION="v2024.1" ENV SOFTCONSOLE_VERSION="v2022.2-RISC-V-747" -ENV MICROCHIP_TOOLS_DIR="/opt/microchip" -ENV LIBERO_DIR="${MICROCHIP_TOOLS_DIR}/Libero_SoC_${LIBERO_VERSION}" -ENV SC_INSTALL_DIR="${MICROCHIP_TOOLS_DIR}/SoftConsole-${SOFTCONSOLE_VERSION}" -ENV LIBERO_LOG_DIR="${LIBERO_DIR}/Logs" -ENV FPGENPROG="${LIBERO_DIR}/Libero/bin64/fpgenprog" +ENV BASE_DIR="/opt/microchip" ARG DEBIAN_FRONTEND=noninteractive ENV XDG_RUNTIME_DIR="/tmp/.xdg/${UID}" +ENV LIBERO_VERSION="v2024.1" +ENV SOFTCONSOLE_VERSION="v2022.2-RISC-V-747" + +# install dirs +ENV BASE_DIR="/opt/microchip" +ENV INSTALLERS_DIR="${BASE_DIR}/installers" +ENV SCRIPTS_DIR="${BASE_DIR}/scripts" +ENV LIBERO_DIR="${BASE_DIR}/Libero_SoC_${LIBERO_VERSION}" +ENV SC_DIR="${BASE_DIR}/SoftConsole-${SOFTCONSOLE_VERSION}" +ENV LICENSE_DIR="${LIBERO_DIR}/license" +ENV LOG_DIR="${LIBERO_DIR}/Logs" +ENV FPGENPROG="${LIBERO_DIR}/Libero/bin64/fpgenprog" + # prepare the install dirs -RUN mkdir -p ${MICROCHIP_TOOLS_DIR}/common -RUN mkdir -p ${MICROCHIP_TOOLS_DIR}/installers -RUN mkdir -p ${MICROCHIP_TOOLS_DIR}/scripts +RUN echo "Installer daemons to ${BIN_DIR}..." +RUN mkdir -p ${LICENSE_DIR} +RUN mkdir -p ${INSTALLERS_DIR} +RUN mkdir -p ${SCRIPTS_DIR} +RUN mkdir -p ${LOG_DIR} +RUN chown -R libby:libby ${BASE_DIR} RUN mkdir -p $XDG_RUNTIME_DIR +ARG DEBIAN_FRONTEND=noninteractive RUN dpkg --add-architecture i386 && \ apt-get update -y && \ apt-get upgrade -y && \ apt-get install -y libxext6 libx11-6 libxrender1 libxtst6 libxi6 lsb default-jre build-essential -ADD scripts/* ${MICROCHIP_TOOLS_DIR}/scripts/ +ADD scripts/* ${BASE_DIR}/scripts/ # run installer in silent mode using config file RUN echo "Installing Libero... This could take a bit" -RUN ${MICROCHIP_TOOLS_DIR}/installers/Libero_SoC_${LIBERO_VERSION}*.bin -i silent -f ${MICROCHIP_TOOLS_DIR}/installers/installer.cfg +RUN ${BASE_DIR}/installers/Libero_SoC_${LIBERO_VERSION}*.bin -i silent -f ${BASE_DIR}/installers/installer.cfg # RUN echo "Installing SoftConsole... This could take a bit" -# RUN ${MICROCHIP_TOOLS_DIR}/installers/Microchip-SoftConsole-${SOFTCONSOLE_VERSION}-linux-x64-installer.run \ +# RUN ${BASE_DIR}/installers/Microchip-SoftConsole-${SOFTCONSOLE_VERSION}-linux-x64-installer.run \ # --mode unattended --unattendedmodeui minimal --installrenodesources "Yes, I accept Renode's MIT license." \ # --prefix ${SC_INSTALL_DIR} @@ -61,6 +77,10 @@ RUN apt-get install -y xfonts-100dpi xfonts-75dpi xfonts-base \ xfonts-intl-japanese xfonts-intl-japanese-big xkb-data ksh libxft2:i386 -RUN bash -c "echo \". ${MICROCHIP_TOOLS_DIR}/scripts/env\"" >> /root/.profile +USER libby + +ADD ./scripts/* ${SCRIPTS_DIR}/ + +RUN bash -c "echo \". ${SCRIPTS_DIR}/env\"" >> $HOME/.bashrc CMD ["/bin/bash", "-l", "-c"] ENTRYPOINT ["/bin/bash", "-l", "-c"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f76ccd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +LIBERO_IMAGE := "libero" +MICROCHIP_TOOLS_NETWORK := "microchip_tools_network" +MICROCHIP_TOOLS_POD := "microchip_tools_pod" +LIBERO_CONTAINER ::= "localhost/$(LIBERO_IMAGE):latest" + +C_RED= \033[0;31m +C_YELLOW= \033[0;33m +C_GREEN= \033[0;32m +C_END= \033[0m + +build: + podman build . -t libero --volume="${PWD}/installers:/opt/microchip/installers" + +daemon: + podman run -dt --rm --replace --name libero \ + --volume="/etc/localtime:/etc/localtime" --volume="${PWD}/licenses:/opt/microchip/licenses" \ + ${LIBERO_LICENSER_CONTAINER} /opt/microchip/scripts/entrypoint + +# launch a bash shell in the libero container +debug: + podman exec -it --volume="/etc/localtime:/etc/localtime" \ + -v "${XAUTHORITY}:${XAUTHORITY}:ro" -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -e "DISPLAY" --security-opt label=type:container_runtime_t ${LIBERO_CONTAINER} + +run: + podman exec -it --volume="/etc/localtime:/etc/localtime" \ + -v "${XAUTHORITY}:${XAUTHORITY}:ro" -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -e "DISPLAY" --security-opt label=type:container_runtime_t ${LIBERO_CONTAINER} libero diff --git a/microchip_license_server/Dockerfile b/microchip_license_server/Dockerfile deleted file mode 100644 index 9564973..0000000 --- a/microchip_license_server/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM ubuntu:22.04 - -RUN useradd -r -s /sbin/nologin -c "Microchip daemon runner" -m libby -USER root - -ENV BASE_DIR="/opt/microchip" -ENV BIN_DIR="${BASE_DIR}/bin" -ENV INSTALLERS_DIR="${BASE_DIR}/installers" -ENV LICENSE_DIR="${BASE_DIR}/licenses" -ENV LOG_DIR="${BASE_DIR}/logs" -ENV SCRIPTS_DIR="${BASE_DIR}/scripts" - -ARG DEBIAN_FRONTEND=noninteractive -RUN dpkg --add-architecture i386 && \ - apt-get update -y && \ - apt-get upgrade -y && \ - apt-get install -y build-essential lsb-core - -RUN echo "Installer daemons to ${BIN_DIR}..." -RUN mkdir -p ${LICENSE_DIR} -RUN mkdir -p ${INSTALLERS_DIR} -RUN mkdir -p ${BIN_DIR} -RUN mkdir -p ${SCRIPTS_DIR} -RUN mkdir -p ${LOG_DIR} -RUN chown -R libby:libby ${BASE_DIR} - -USER libby - -ADD ./scripts/* ${SCRIPTS_DIR}/ -RUN tar -xvf "${INSTALLERS_DIR}/Linux_Licensing_Daemon.tar.Z" -C "${INSTALLERS_DIR}" -RUN mv ${INSTALLERS_DIR}/Linux_Licensing_Daemon/* "${BIN_DIR}/" - - - -RUN bash -c "echo \". ${SCRIPTS_DIR}/env\"" >> $HOME/.bashrc -CMD ["/bin/bash", "-l", "-c"] -ENTRYPOINT ["/bin/bash", "-l", "-c"] diff --git a/microchip_license_server/Makefile b/microchip_license_server/Makefile deleted file mode 100644 index ff04213..0000000 --- a/microchip_license_server/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -LIBERO_LICENSER_IMAGE = libero_licenser -MICROCHIP_TOOLS_POD = microchip_tools_pod -MICROCHIP_TOOLS_NETWORK = microchip_tools_network -LIBERO_LICENSER_CONTAINER ::= localhost/$(LIBERO_LICENSER_IMAGE):latest - -build: - podman build . -t libero_licenser --volume="${PWD}/../installers:/opt/microchip/installers" - - -start: - podman run -it --rm -h libero-licenser --name libero_licenser --network ${MICROCHIP_TOOLS_NETWORK} \ - --volume="/etc/localtime:/etc/localtime" --volume="${PWD}/../licenses:/opt/microchip/licenses" \ - --mac-address ${LIBERO_LICENSE_MAC} \ - ${LIBERO_LICENSER_CONTAINER} /opt/microchip/scripts/entrypoint diff --git a/microchip_license_server/scripts/entrypoint b/microchip_license_server/scripts/entrypoint deleted file mode 100755 index f225cd1..0000000 --- a/microchip_license_server/scripts/entrypoint +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -"${BIN_DIR}/lmgrd" -z -c "${LICENSE_DIR}/License.dat" diff --git a/microchip_license_server/scripts/env b/microchip_license_server/scripts/env deleted file mode 100755 index 1561b34..0000000 --- a/microchip_license_server/scripts/env +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -export BASE_DIR="/opt/microchip" -export BIN_DIR="${BASE_DIR}/bin" -export INSTALLERS_DIR="${BASE_DIR}/installers" -export LICENSE_DIR="${BASE_DIR}/licenses" -export LOG_DIR="${BASE_DIR}/logs" -export SCRIPTS_DIR="${BASE_DIR}/scripts" - -export LM_LICENSE_FILE="1702@libero-licenser" -export SNPSLMD_LICENSE_FILE="1702@libero-licenser" -export PATH="${BIN_DIR}:${PATH}" diff --git a/microchip_tools/Makefile b/microchip_tools/Makefile deleted file mode 100644 index c43d568..0000000 --- a/microchip_tools/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -LIBERO_IMAGE := "libero" -MICROCHIP_TOOLS_NETWORK := "microchip_tools_network" -MICROCHIP_TOOLS_POD := "microchip_tools_pod" -LIBERO_CONTAINER ::= "localhost/$(LIBERO_IMAGE):latest" -LIBERO_CONTAINER_HOSTNAME = $(LIBERO_IMAGE) - -C_RED= \033[0;31m -C_YELLOW= \033[0;33m -C_GREEN= \033[0;32m -C_END= \033[0m - - -all: container - -build: - podman build . -t $(LIBERO_IMAGE) --volume="${PWD}/../installers:/opt/microchip/installers" - -# launch a bash shell in the libero container -debug: - podman run --rm -it --volume="/etc/localtime:/etc/localtime" --network $(MICROCHIP_TOOLS_NETWORK) \ - --mac-address ${LIBERO_LICENSE_MAC} -v "${XAUTHORITY}:${XAUTHORITY}:ro" -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -e "DISPLAY" --security-opt label=type:container_runtime_t ${LIBERO_CONTAINER} - -# run libero -run: - podman run -it --volume="/etc/localtime:/etc/localtime" --network $(MICROCHIP_TOOLS_NETWORK) \ - --mac-address ${LIBERO_LICENSE_MAC} -v "${XAUTHORITY}:${XAUTHORITY}:ro" -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -e "DISPLAY" --security-opt label=type:container_runtime_t ${LIBERO_CONTAINER} libero - -network: - @podman network create $(MICROCHIP_TOOLS_NETWORK) >/dev/null 2>&1 \ - && printf "${C_GREEN}Created podman network: ${MICROCHIP_TOOLS_NETWORK}${C_END}\n" \ - || printf "${C_YELLOW}network \"${MICROCHIP_TOOLS_NETWORK}\" already exists${C_END}\n" -# end diff --git a/microchip_tools/scripts/env b/microchip_tools/scripts/env deleted file mode 100755 index 039918d..0000000 --- a/microchip_tools/scripts/env +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -export LIBERO_VERSION="v2024.1" -export SOFTCONSOLE_VERSION="v2022.2-RISC-V-747" -export MICROCHIP_TOOLS_DIR="/opt/microchip" -export LIBERO_DIR="${MICROCHIP_TOOLS_DIR}/Libero_SoC_${LIBERO_VERSION}" -export SC_INSTALL_DIR="${MICROCHIP_TOOLS_DIR}/SoftConsole-${SOFTCONSOLE_VERSION}" -export LIBERO_LICENSE_DIR="${LIBERO_DIR}/license" -export LIBERO_LOG_DIR="${LIBERO_DIR}/Logs" -export LM_LICENSE_FILE="1702@LPOD" -export SNPSLMD_LICENSE_FILE="1702@LPOD" -export PATH="${PATH}:${LIBERO_DIR}/Libero/bin64" -export PATH="${PATH}:${SC_INSTALL_DIR}/python3/bin:${SC_INSTALL_DIR}" -export FPGENPROG="${LIBERO_DIR}/Libero/bin64/fpgenprog" diff --git a/scripts/env b/scripts/env new file mode 100644 index 0000000..dae8159 --- /dev/null +++ b/scripts/env @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +__hostname=$(hostname) + +# versions +export LIBERO_VERSION="v2024.1" +export SOFTCONSOLE_VERSION="v2022.2-RISC-V-747" + +# install dirs +export BASE_DIR="/opt/microchip" +export INSTALLERS_DIR="${BASE_DIR}/installers" +export SCRIPTS_DIR="${BASE_DIR}/scripts" +export LIBERO_DIR="${BASE_DIR}/Libero_SoC_${LIBERO_VERSION}" +export SC_DIR="${BASE_DIR}/SoftConsole-${SOFTCONSOLE_VERSION}" +export LICENSE_DIR="${LIBERO_DIR}/license" +export LOG_DIR="${LIBERO_DIR}/Logs" +export FPGENPROG="${LIBERO_DIR}/Libero/bin64/fpgenprog" + +# license vars +export LM_LICENSE_FILE="1702@gpenguin" +export SNPSLMD_LICENSE_FILE="1702@gpenguin" + +# paths +export PATH="${PATH}:${LIBERO_DIR}/Libero/bin64" +export PATH="${PATH}:${SC_INSTALL_DIR}/python3/bin:${SC_INSTALL_DIR}" diff --git a/microchip_tools/scripts/verify_installers b/scripts/verify_installers similarity index 100% rename from microchip_tools/scripts/verify_installers rename to scripts/verify_installers