mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
Adding kernel sources to docker compiler image
This commit is contained in:
parent
512bfae169
commit
895fb3d221
@ -14,6 +14,13 @@ RUN for V in ${PLATFORMS}; do \
|
||||
"usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-${TOOLKIT_VER}" && \
|
||||
echo "Extracting ${PLATFORM}-toolchain.txz" && \
|
||||
tar -xaf "/cache/${PLATFORM}-toolchain.txz" -C "/opt/${PLATFORM}" --strip-components=1; \
|
||||
KVER_MAJOR="`echo ${KVER} | rev | cut -d. -f2- | rev`"; \
|
||||
if [ ! -d "/opt/linux-${KVER_MAJOR}.x" -a -f "/cache/linux-${KVER_MAJOR}.x.txz" ]; then \
|
||||
echo "Extracting linux-${KVER_MAJOR}.x.txz" && \
|
||||
tar -xaf "/cache/linux-${KVER_MAJOR}.x.txz" -C "/opt"; \
|
||||
rm -rf /opt/${PLATFORM}/source && \
|
||||
ln -s /opt/linux-${KVER_MAJOR}.x /opt/${PLATFORM}/source; \
|
||||
fi; \
|
||||
done; \
|
||||
done
|
||||
|
||||
@ -22,20 +29,22 @@ FROM debian:8-slim
|
||||
ENV SHELL=/bin/bash \
|
||||
ARCH=x86_64
|
||||
|
||||
COPY --from=stage /opt /opt
|
||||
RUN apt update --yes && \
|
||||
apt install --yes --no-install-recommends --no-install-suggests --allow-unauthenticated \
|
||||
ca-certificates nano curl bc kmod git gettext texinfo autopoint gawk sudo \
|
||||
build-essential make ncurses-dev libssl-dev autogen automake pkg-config libtool xsltproc gperf && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
useradd --home-dir /input --no-create-home --shell /bin/bash --uid 1000 arpl && \
|
||||
echo "arpl ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/arpl
|
||||
useradd --create-home --shell /bin/bash --uid 1000 --user-group arpl && \
|
||||
echo "arpl ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/arpl && \
|
||||
chown 1000:1000 -R /opt && \
|
||||
mkdir /output && chown 1000:1000 /output
|
||||
|
||||
COPY --from=stage /opt /opt
|
||||
COPY files/ /
|
||||
|
||||
USER arpl
|
||||
WORKDIR /input
|
||||
VOLUME /input /output
|
||||
USER arpl
|
||||
|
||||
ENTRYPOINT ["/opt/do.sh"]
|
||||
|
@ -25,6 +25,8 @@ function prepare() {
|
||||
URLS["r1000"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/AMD%20x86%20Linux%204.4.180%20%28r1000%29/r1000-${GCCLIB_VER}_x86_64-GPL.txz"
|
||||
URLS["epyc7002"]="https://global.download.synology.com/download/ToolChain/toolchain/${TOOLCHAIN_VER}/AMD%20x86%20Linux%20Linux%205.10.55%20%28epyc7002%29/epyc7002-${GCCLIB_VER}_x86_64-GPL.txz"
|
||||
|
||||
URLS["3.10.x"]="https://ufpr.dl.sourceforge.net/project/dsgpl/Synology%20NAS%20GPL%20Source/25426branch/bromolow-source/linux-3.10.x.txz"
|
||||
|
||||
# Read platforms/kerver version
|
||||
echo "Reading platforms"
|
||||
declare -A PLATFORMS
|
||||
@ -40,7 +42,7 @@ function prepare() {
|
||||
echo -n "Checking ${CACHE_DIR}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz... "
|
||||
if [ ! -f "${CACHE_DIR}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" ]; then
|
||||
URL="https://global.download.synology.com/download/ToolChain/toolkit/${TOOLKIT_VER}/${PLATFORM}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz"
|
||||
echo "Downloading ${URL}"
|
||||
echo -e "No\nDownloading ${URL}"
|
||||
curl -L "${URL}" -o "${CACHE_DIR}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz"
|
||||
else
|
||||
echo "OK"
|
||||
@ -48,13 +50,25 @@ function prepare() {
|
||||
echo -n "Checking ${CACHE_DIR}/${PLATFORM}-toolchain.txz... "
|
||||
if [ ! -f "${CACHE_DIR}/${PLATFORM}-toolchain.txz" ]; then
|
||||
URL=${URLS["${PLATFORM}"]}
|
||||
echo "Downloading ${URL}"
|
||||
echo -e "No\nDownloading ${URL}"
|
||||
curl -L "${URL}" -o "${CACHE_DIR}/${PLATFORM}-toolchain.txz"
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
done
|
||||
|
||||
for KERNEL in 3.10.x 4.4.x 5.10.x; do
|
||||
URL=${URLS["${KERNEL}"]}
|
||||
[ -z "${URL}" ] && continue
|
||||
echo -n "Checking ${CACHE_DIR}/linux-${KERNEL}.txz... "
|
||||
if [ ! -f "${CACHE_DIR}/linux-${KERNEL}.txz" ]; then
|
||||
echo -e "No\nDownloading ${URL}"
|
||||
curl -L "${URL}" -o "${CACHE_DIR}/linux-${KERNEL}.txz"
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
done
|
||||
|
||||
# Generate Dockerfile
|
||||
echo "Generating Dockerfile"
|
||||
cp Dockerfile.template Dockerfile
|
||||
|
@ -18,12 +18,15 @@ function export-vars() {
|
||||
export ARCH=x86_64
|
||||
export CC="x86_64-pc-linux-gnu-gcc"
|
||||
export LD="x86_64-pc-linux-gnu-ld"
|
||||
export PATH="/opt/${1}/bin:${PATH}"
|
||||
echo "export PATH=\"/opt/${1}/bin:${PATH}\"" | \
|
||||
sudo tee /etc/profile.d/path.sh >/dev/null
|
||||
sudo chmod +x /etc/profile.d/path.sh
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
function shell() {
|
||||
#cp /opt/${2}/build/System.map /input
|
||||
cp -fv /opt/${2}/build/.config /opt/${2}/source/
|
||||
cp -fv /opt/${2}/build/System.map /opt/${2}/source/
|
||||
export-vars $2
|
||||
shift 2
|
||||
bash -l $@
|
||||
|
Loading…
x
Reference in New Issue
Block a user