From 048b5e0e3fa7b19661846bdd08c14b36c2392a30 Mon Sep 17 00:00:00 2001 From: penguin Date: Sun, 22 Sep 2024 20:49:52 -0500 Subject: [PATCH] reset repo --- installers/installer.cfg | 19 ++++++ licenses/README.org | 0 microchip_license_server/Dockerfile | 37 ++++++++++++ microchip_license_server/Makefile | 14 +++++ microchip_license_server/scripts/entrypoint | 2 + microchip_license_server/scripts/env | 12 ++++ microchip_tools/Dockerfile | 66 +++++++++++++++++++++ microchip_tools/Makefile | 34 +++++++++++ microchip_tools/scripts/env | 14 +++++ microchip_tools/scripts/verify_installers | 9 +++ scripts/entrypoint | 4 ++ 11 files changed, 211 insertions(+) create mode 100644 installers/installer.cfg create mode 100644 licenses/README.org create mode 100644 microchip_license_server/Dockerfile create mode 100644 microchip_license_server/Makefile create mode 100755 microchip_license_server/scripts/entrypoint create mode 100755 microchip_license_server/scripts/env create mode 100644 microchip_tools/Dockerfile create mode 100644 microchip_tools/Makefile create mode 100755 microchip_tools/scripts/env create mode 100755 microchip_tools/scripts/verify_installers create mode 100755 scripts/entrypoint diff --git a/installers/installer.cfg b/installers/installer.cfg new file mode 100644 index 0000000..0887ed1 --- /dev/null +++ b/installers/installer.cfg @@ -0,0 +1,19 @@ +************************************************* + +#Installation Flow +#----------------- +USER_INPUT_RESULT_1=1 +USER_INPUT_RESULT_2=0 +USER_INPUT_RESULT_3=0 + +#Choose Install Directory +USER_INSTALL_DIR=/opt/microchip/Libero_SoC_v2024.1 +USER_COMMON_DIR=/opt/microchip/common + +#Choose Install Set +#------------------ +CHOSEN_FEATURE_LIST=Libero,Synplify,ModelsimPro,QuestaSim,Identify,SmartHLS +CHOSEN_INSTALL_FEATURE_LIST=Libero,Synplify,ModelsimPro,QuestaSim,Identify,SmartHLS +CHOSEN_INSTALL_SET=Custom + +************************************************ diff --git a/licenses/README.org b/licenses/README.org new file mode 100644 index 0000000..e69de29 diff --git a/microchip_license_server/Dockerfile b/microchip_license_server/Dockerfile new file mode 100644 index 0000000..9564973 --- /dev/null +++ b/microchip_license_server/Dockerfile @@ -0,0 +1,37 @@ +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 new file mode 100644 index 0000000..ff04213 --- /dev/null +++ b/microchip_license_server/Makefile @@ -0,0 +1,14 @@ +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 new file mode 100755 index 0000000..f225cd1 --- /dev/null +++ b/microchip_license_server/scripts/entrypoint @@ -0,0 +1,2 @@ +#!/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 new file mode 100755 index 0000000..1561b34 --- /dev/null +++ b/microchip_license_server/scripts/env @@ -0,0 +1,12 @@ +#!/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/Dockerfile b/microchip_tools/Dockerfile new file mode 100644 index 0000000..8ce0668 --- /dev/null +++ b/microchip_tools/Dockerfile @@ -0,0 +1,66 @@ +FROM ubuntu:22.04 + +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" +ARG DEBIAN_FRONTEND=noninteractive +ENV XDG_RUNTIME_DIR="/tmp/.xdg/${UID}" + +# 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 mkdir -p $XDG_RUNTIME_DIR + +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/ +# 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 echo "Installing SoftConsole... This could take a bit" +# RUN ${MICROCHIP_TOOLS_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} + +# 32 bit deps +RUN apt-get install -y libc6:i386 libdrm2:i386 libexpat1:i386 \ + libfontconfig1:i386 libfreetype6:i386 libglapi-mesa:i386 \ + libglib2.0-0:i386 libgl1:i386 libice6:i386 \ + libsm6:i386 libuuid1:i386 libx11-6:i386 \ + libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 \ + libxcb-glx0:i386 libxcb1:i386 libxdamage1:i386 \ + libxext6:i386 libxfixes3:i386 libxrender1:i386 libxxf86vm1:i386 + +# gui deps i think? +RUN apt-get install -y libasound2 libasyncns0 libdbus-1-3 \ + libdrm2 libegl1 libexpat1 \ + libflac8 libfontconfig1 libfreetype6 \ + libgbm1 libglapi-mesa libglib2.0-0 \ + libgl1 libice6 libnspr4 \ + libnss3 libogg0 libpulse0 \ + libsm6 libsndfile1 libsqlite3-0 \ + libvorbisenc2 libvorbis0a libwrap0 \ + libx11-xcb1 libxcb-dri2-0 libxcb-glx0 \ + libxcb-render0 libxcb-shape0 libxcb-xfixes0 \ + libxcomposite1 libxcursor1 libxdamage1 \ + libxfixes3 libxslt1.1 libxxf86vm1 + +# fonts! +RUN apt-get install -y xfonts-100dpi xfonts-75dpi xfonts-base \ + xfonts-intl-asian xfonts-intl-chinese xfonts-intl-chinese-big \ + xfonts-intl-japanese xfonts-intl-japanese-big xkb-data ksh libxft2:i386 + + +RUN bash -c "echo \". ${MICROCHIP_TOOLS_DIR}/scripts/env\"" >> /root/.profile +CMD ["/bin/bash", "-l", "-c"] +ENTRYPOINT ["/bin/bash", "-l", "-c"] diff --git a/microchip_tools/Makefile b/microchip_tools/Makefile new file mode 100644 index 0000000..c43d568 --- /dev/null +++ b/microchip_tools/Makefile @@ -0,0 +1,34 @@ +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 new file mode 100755 index 0000000..039918d --- /dev/null +++ b/microchip_tools/scripts/env @@ -0,0 +1,14 @@ +#!/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/microchip_tools/scripts/verify_installers b/microchip_tools/scripts/verify_installers new file mode 100755 index 0000000..f965268 --- /dev/null +++ b/microchip_tools/scripts/verify_installers @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +INSTALLERPATH="${SCRIPTPATH}/../installers" +. "${SCRIPTPATH}/env" +if ! [[ -f "${INSTALLERPATH}/Libero_SoC_${LIBERO_VERSION}.bin" ]]; then + echo "Installer not found. Did you download the installer?" +else + echo "Installer found" +fi diff --git a/scripts/entrypoint b/scripts/entrypoint new file mode 100755 index 0000000..373c6e7 --- /dev/null +++ b/scripts/entrypoint @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +. /opt/microchip/scripts/env +${LIBERO_DIR}/Libero/bin64/lmgrd -z -c ${LIBERO_LICENSE_DIR}/License.dat -l ${LIBERO_LOG_DIR}/license.log