Skip to content

Commit b67b364

Browse files
committed
Init.
0 parents  commit b67b364

34 files changed

Lines changed: 675 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-22.04
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
target:
17+
- aarch64-unknown-linux-gnu
18+
- arm-unknown-linux-gnueabi
19+
- arm-unknown-linux-gnueabihf
20+
- armv7-unknown-linux-gnueabi
21+
- armv7-unknown-linux-gnueabihf
22+
- i586-unknown-linux-gnu
23+
- i686-unknown-linux-gnu
24+
- loongarch64-unknown-linux-gnu
25+
- m68k-unknown-linux-gnu
26+
- microblazeel-xilinx-linux-gnu
27+
- microblaze-xilinx-linux-gnu
28+
- mipsel-unknown-linux-gnu
29+
- mipsel-unknown-linux-gnusf
30+
- mips-unknown-linux-gnu
31+
- mips-unknown-linux-gnusf
32+
- mips64el-unknown-linux-gnu
33+
- mips64-unknown-linux-gnu
34+
- powerpc-unknown-linux-gnu
35+
- powerpc64-unknown-linux-gnu
36+
- riscv32-unknown-linux-gnu
37+
- riscv64-unknown-linux-gnu
38+
- s390x-ibm-linux-gnu
39+
- sh-multilib-linux-gnu
40+
- x86_64-unknown-linux-gnu
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 1
46+
submodules: true
47+
- name: Build
48+
run: |
49+
sudo rm -rf /opt/*
50+
./scripts/make ${{ matrix.target }}
51+
- name: Upload package
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: ${{ matrix.target }}.tar.xz
55+
path: ${{ matrix.target }}.tar.xz
56+
if-no-files-found: error
57+
retention-days: 1
58+
- name: Upload checksum
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: ${{ matrix.target }}.tar.xz.sha256
62+
path: ${{ matrix.target }}.tar.xz.sha256
63+
if-no-files-found: error
64+
retention-days: 1
65+
66+
release:
67+
name: Release
68+
runs-on: ubuntu-22.04
69+
needs:
70+
- build
71+
if: github.event_name == 'release'
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v4
75+
with:
76+
fetch-depth: 1
77+
- name: Download artifacts
78+
uses: actions/download-artifact@v4
79+
with:
80+
path: release
81+
pattern: "*.tar.*"
82+
merge-multiple: true
83+
- name: Generate checksums
84+
run: |
85+
echo "| Filename | Sha256sum |" > RELEASE.md
86+
echo "| -------- | --------- |" >> RELEASE.md
87+
for i in release/*.sha256; do
88+
echo "| $(basename $i .sha256) | $(cat $i) |" >> RELEASE.md
89+
done
90+
- name: Upload artifacts
91+
env:
92+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
run: |
94+
for i in release/*.tar.xz; do
95+
gh release upload ${{ github.event.release.tag_name }} $i $i.sha256
96+
done
97+
gh release edit ${{ github.event.release.tag_name }} -F RELEASE.md

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "builder"]
2+
path = builder
3+
url = https://github.com/crosstool-ng/crosstool-ng

License

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2024 hev
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# gnu-cross
2+
3+
This is a simple, lightweight project for making cross-compilation toolchain with gnu libc.
4+
5+
## Supported targets
6+
7+
| Target | Kernel | Binutils | GCC | Glibc |
8+
|-------------------------------|---------|----------|--------|-------|
9+
| aarch64-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
10+
| arm-unknown-linux-gnueabi | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
11+
| arm-unknown-linux-gnueabihf | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
12+
| armv7-unknown-linux-gnueabi | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
13+
| armv7-unknown-linux-gnueabihf | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
14+
| i586-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
15+
| i686-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
16+
| loongarch64-unknown-linux-gnu | 5.19.16 | 2.43.1 | 14.2.0 | 2.41 |
17+
| m68k-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
18+
| microblazeel-xilinx-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
19+
| microblaze-xilinx-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
20+
| mipsel-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
21+
| mipsel-unknown-linux-gnusf | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
22+
| mips-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
23+
| mips-unknown-linux-gnusf | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
24+
| mips64el-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
25+
| mips64-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
26+
| powerpc-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
27+
| powerpc64-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
28+
| riscv32-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
29+
| riscv64-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
30+
| s390x-ibm-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
31+
| sh-multilib-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
32+
| x86_64-unknown-linux-gnu | 5.4.289 | 2.43.1 | 14.2.0 | 2.41 |
33+
34+
## How to use
35+
36+
Download the tarball from the [release page](https://github.com/cross-tools/gnu-cross/releases) and extract it to `/opt/x-tools`:
37+
38+
```sh
39+
sudo mkdir -p /opt/x-tools
40+
sudo tar -xf ${target}.tar.xz -C /opt/x-tools
41+
```
42+
43+
## How to build
44+
45+
Fork this project and create a new release, or build manually:
46+
47+
```sh
48+
./scripts/make ${target}
49+
```
50+
51+
## License
52+
53+
MIT
54+
55+
## Acknowledgements
56+
57+
We would like to express our gratitude to the following individuals and projects:
58+
59+
- [crosstool-ng](https://github.com/crosstool-ng/crosstool-ng)
60+
- [glibc](https://www.gnu.org/software/libc)

builder

Submodule builder added at 70c2b00

scripts/make

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
TARGET=$1
6+
7+
# packages
8+
sudo apt-get update
9+
sudo apt-get install -y --no-install-recommends \
10+
automake \
11+
bison \
12+
bzip2 \
13+
ca-certificates \
14+
curl \
15+
file \
16+
flex \
17+
g++ \
18+
gawk \
19+
gdb \
20+
git \
21+
gperf \
22+
help2man \
23+
libncurses-dev \
24+
libssl-dev \
25+
libtool-bin \
26+
make \
27+
patch \
28+
pkg-config \
29+
python3 \
30+
rsync \
31+
texinfo \
32+
unzip \
33+
wget \
34+
xz-utils
35+
36+
# patch
37+
pushd builder
38+
for i in ../targets/${TARGET}/*; do
39+
if [[ $i == *.patch ]]; then
40+
patch -Np1 -i $i
41+
fi
42+
done
43+
popd
44+
45+
# crosstool-ng
46+
if [ ! -e /usr/bin/ct-ng ]; then
47+
pushd builder
48+
./bootstrap
49+
./configure --prefix=/usr
50+
make -j`nproc`
51+
sudo make install
52+
popd
53+
fi
54+
55+
# build
56+
sudo mkdir -p /opt
57+
sudo chmod 0777 /opt
58+
mkdir -p build
59+
cp targets/${TARGET}/config build/.config
60+
pushd build
61+
ct-ng olddefconfig
62+
ct-ng build
63+
popd
64+
65+
# tarball
66+
sudo mv /opt/x-tools/${TARGET} .
67+
sudo chown -R root:root ${TARGET}
68+
sudo tar -cJvf ${TARGET}.tar.xz ${TARGET}
69+
sudo sha256sum ${TARGET}.tar.xz | awk '{ print $1 }' > ${TARGET}.tar.xz.sha256
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_EXPERIMENTAL=y
3+
CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}"
4+
# CT_LOG_PROGRESS_BAR is not set
5+
CT_ARCH_ARM=y
6+
CT_ARCH_64=y
7+
CT_TARGET_VENDOR=""
8+
CT_KERNEL_LINUX=y
9+
CT_LINUX_V_5_4=y
10+
CT_BINUTILS_LINKER_LD_GOLD=y
11+
CT_BINUTILS_GOLD_THREADS=y
12+
CT_BINUTILS_LD_WRAPPER=y
13+
CT_BINUTILS_PLUGINS=y
14+
CT_LIBC_GLIBC=y
15+
CT_CC_LANG_CXX=y
16+
CT_GETTEXT_NEEDED=y
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_EXPERIMENTAL=y
3+
CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}"
4+
# CT_LOG_PROGRESS_BAR is not set
5+
CT_ARCH_ARM=y
6+
CT_ARCH_FLOAT_SW=y
7+
CT_KERNEL_LINUX=y
8+
CT_LINUX_V_5_4=y
9+
CT_BINUTILS_LINKER_LD_GOLD=y
10+
CT_BINUTILS_GOLD_THREADS=y
11+
CT_BINUTILS_LD_WRAPPER=y
12+
CT_BINUTILS_PLUGINS=y
13+
CT_BINUTILS_FOR_TARGET=y
14+
CT_LIBC_GLIBC=y
15+
CT_CC_LANG_CXX=y
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_EXPERIMENTAL=y
3+
CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}"
4+
# CT_LOG_PROGRESS_BAR is not set
5+
CT_ARCH_ARM=y
6+
CT_ARCH_FLOAT_HW=y
7+
CT_KERNEL_LINUX=y
8+
CT_LINUX_V_5_4=y
9+
CT_BINUTILS_LINKER_LD_GOLD=y
10+
CT_BINUTILS_GOLD_THREADS=y
11+
CT_BINUTILS_LD_WRAPPER=y
12+
CT_BINUTILS_PLUGINS=y
13+
CT_BINUTILS_FOR_TARGET=y
14+
CT_LIBC_GLIBC=y
15+
CT_CC_LANG_CXX=y
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_EXPERIMENTAL=y
3+
CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}"
4+
# CT_LOG_PROGRESS_BAR is not set
5+
CT_ARCH_ARM=y
6+
CT_ARCH_SUFFIX="v7"
7+
CT_ARCH_ARCH="armv7-a"
8+
CT_ARCH_FLOAT_SW=y
9+
CT_KERNEL_LINUX=y
10+
CT_LINUX_V_5_4=y
11+
CT_BINUTILS_LINKER_LD_GOLD=y
12+
CT_BINUTILS_GOLD_THREADS=y
13+
CT_BINUTILS_LD_WRAPPER=y
14+
CT_BINUTILS_PLUGINS=y
15+
CT_BINUTILS_FOR_TARGET=y
16+
CT_LIBC_GLIBC=y
17+
CT_CC_LANG_CXX=y

0 commit comments

Comments
 (0)