-
Notifications
You must be signed in to change notification settings - Fork 0
/
container.def
150 lines (117 loc) · 4.63 KB
/
container.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Bootstrap: docker
From: ubuntu:24.04
%runscript
#!/bin/sh
/bin/sh -c "$*"
%environment
export LANG=C.UTF-8
# https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/
export RUBY_VERSION=3.3.0
export RUBY_DOWNLOAD_URL=https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.xz
export RUBY_DOWNLOAD_SHA256=676b65a36e637e90f982b57b059189b3276b9045034dcd186a7e9078847b975b
export BUNDLE_SILENCE_ROOT_WARNING=1
%post
NCPUS=`cat /proc/cpuinfo | grep processor | cut -d ' ' -f 2 | tail -n 1 | tr -d "\n"`
apt update
DEBIAN_FRONTEND=noninteractive apt upgrade -y
# install riscv32 gnu toolchain
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev libslirp-dev
# we need specific versions of gcc and binutils to get Zc* support
git clone https://gcc.gnu.org/git/gcc.git --depth=1 --branch releases/gcc-14.1.0
# roundabout way to get a shallow clone of a specific commit...
mkdir binutils
cd binutils
git init
git remote add origin https://github.com/openhwgroup/corev-binutils-gdb
git fetch --depth 1 origin 6d51ebc14b82e9af4187c28591b51841844e3a50
git checkout FETCH_HEAD
cd ..
# glibc is ok at the default
git clone https://github.com/riscv/riscv-gnu-toolchain --depth=1 --branch 2024.04.12
cd riscv-gnu-toolchain
git submodule init glibc
git submodule update --depth=1 glibc
# gcc newlib -- baremetal/rtos
mkdir gcc_rtos
cd gcc_rtos
../configure --prefix=/opt/riscv/gcc \
--with-gcc-src=/gcc \
--with-binutils-src=/binutils \
--enable-multilib \
--with-multilib-generator="rv32ima_zba_zbb_zbs_zca_zcb_zcmp-ilp32--zcmt;rv64ima_zba_zbb_zbs_zca_zcb_zcmp-lp64--" \
--disable-gdb
make -j $NCPUS
cd ..
rm -rf gcc_rtos
# gcc glibc -- linux
mkdir gcc_linux
cd gcc_linux
../configure --prefix=/opt/riscv/gcc \
--with-gcc-src=/gcc \
--with-binutils-src=/binutils \
--enable-multilib \
--with-multilib-generator="rv32ima_zba_zbb_zbs_zca_zcb_zcmp-ilp32--;rv64gcv_zba_zbb_zbs_zca_zcb-lp64d--" \
--disable-gdb
make -j $NCPUS linux
cd ..
rm -rf gcc_rtos
# cleanup everything from the toolchain build
cd ..
rm -rf riscv-gnu-toolchain
rm -rf gcc
rm -rf binutils
DEBIAN_FRONTEND=noninteractive apt remove -y autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev libslirp-dev
# prereqs for AOSP
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends ssh git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 libncurses6 x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig rsync
# install ruby
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends ruby ruby-dev
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends ruby-bundler
# install tools for Zephyr build (https://docs.zephyrproject.org/2.7.5/getting_started/index.html)
# DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends wget
# wget https://apt.kitware.com/kitware-archive.sh
# bash kitware-archive.sh
# install dependencies for Zephyr build
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-wheel python3-pip xz-utils file \
make gcc gcc-multilib g++-multilib libsdl2-dev
# install clang 18
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends lsb-release wget software-properties-common gnupg
wget https://apt.llvm.org/llvm.sh
yes | /bin/bash llvm.sh 18
DEBIAN_FRONTEND=noninteractive apt-get install -y flang-18
# DEBIAN_FRONTEND=noninteractive apt-get install --install-recommends -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu gfortran-riscv64-linux-gnu
# cleanup
apt-get clean autoclean
apt-get autoremove -y
rm -rf /var/lib/{apt, dpkg, cache, log}
%apprun ruby
#!/bin/bash
ruby "$@"
%apphelp ruby
Run ruby.
%apprun bundle
#!/bin/bash
bundle "$@"
%apphelp bundle
Run bundler.
%apprun python3
#!/bin/bash
python3 "$@"
%apphelp python3
Run python3.
%apprun pip3
#!/bin/bash
pip3 "$@"
%apphelp pip3
Run pip3.
%apprun cmake
#!/bin/bash
cmake "$@"
%apphelp cmake
Run cmake.
%apprun dtc
#!/bin/bash
dtc "$@"
%apphelp dtc
Run dtc.