Skip to content

Commit be3d097

Browse files
committed
Add linux example project.
1 parent 6317dd7 commit be3d097

39 files changed

Lines changed: 13235 additions & 1 deletion

.github/license-check/license-config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"**/*.yml",
55
"**/CMakeLists.txt",
66
"**/*.cmake.in",
7+
"**/*.mk",
8+
"**/*.sh",
9+
"**/Config.in",
10+
"**/Kbuild",
11+
"examples/linux/br_external/external.desc",
712
".clang-format",
813
".gitignore"
914
],
@@ -26,7 +31,8 @@
2631
{
2732
"include": [
2833
"**/*.md",
29-
"**/*.txt"
34+
"**/*.txt",
35+
"examples/linux/br_external/configs/*"
3036
],
3137
"exclude": [
3238
"**/CMakeLists.txt"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2026 Aurora Operations, Inc.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0
4+
#
5+
# This work is dual licensed.
6+
# You may use it under Apache-2.0 or GPL-2.0 at your option.
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
# OR
21+
#
22+
# This program is free software; you can redistribute it and/or
23+
# modify it under the terms of the GNU General Public License
24+
# as published by the Free Software Foundation; either version 2
25+
# of the License, or (at your option) any later version.
26+
#
27+
# This program is distributed in the hope that it will be useful,
28+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
29+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30+
# GNU General Public License for more details.
31+
#
32+
# You should have received a copy of the GNU General Public License
33+
# along with this program; if not, see
34+
# <https://www.gnu.org/licenses/>.
35+
36+
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20cli/Config.in"
37+
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20crypto/Config.in"
38+
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20device/Config.in"
39+
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20sw/Config.in"
40+
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20lib/Config.in"
41+
source "$BR2_EXTERNAL_NAT20_PATH/package/libnat20/Config.in"
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/bash
2+
3+
# Copyright 2026 Aurora Operations, Inc.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0
6+
#
7+
# This work is dual licensed.
8+
# You may use it under Apache-2.0 or GPL-2.0 at your option.
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License");
11+
# you may not use this file except in compliance with the License.
12+
# You may obtain a copy of the License at
13+
#
14+
# http://www.apache.org/licenses/LICENSE-2.0
15+
#
16+
# Unless required by applicable law or agreed to in writing, software
17+
# distributed under the License is distributed on an "AS IS" BASIS,
18+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
# See the License for the specific language governing permissions and
20+
# limitations under the License.
21+
#
22+
# OR
23+
#
24+
# This program is free software; you can redistribute it and/or
25+
# modify it under the terms of the GNU General Public License
26+
# as published by the Free Software Foundation; either version 2
27+
# of the License, or (at your option) any later version.
28+
#
29+
# This program is distributed in the hope that it will be useful,
30+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
31+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+
# GNU General Public License for more details.
33+
#
34+
# You should have received a copy of the GNU General Public License
35+
# along with this program; if not, see
36+
# <https://www.gnu.org/licenses/>.
37+
38+
PROJECT="$1"
39+
LIBNAT20_BR_BUILD_DIR="${2:-${LIBNAT20_ROOT}/buildroot.build}"
40+
LIBNAT20_ROOT="${3:-$(pwd)}"
41+
42+
LIBNAT20_BR_BUILD_DIR="$(readlink -f "${LIBNAT20_BR_BUILD_DIR}")"
43+
LIBNAT20_ROOT="$(readlink -f "${LIBNAT20_ROOT}")"
44+
45+
46+
case "$PROJECT" in
47+
qemu)
48+
;;
49+
*)
50+
echo "Usage: bootstrap.sh <project> <buildroot_build_dir> <libnat20_root>"
51+
echo
52+
echo "This script bootstraps the Buildroot environment for the Dice project."
53+
echo
54+
echo "This script may be run from any directory, as long as the libnat20 root"
55+
echo "directory is specified correctly. The first parameter specifies the project."
56+
echo "See valid options below."
57+
echo "The second parameter specifies the out of tree Buildroot build directory."
58+
echo "It uses \"buildroot.build\" inside of the libnat20 root directory by default."
59+
echo "The third parameter specifies the libnat20 root directory."
60+
echo "It uses the current working directory by default."
61+
echo
62+
echo "Available projects:"
63+
echo " qemu - Setup Buildroot for the QEMU-based Dice emulator"
64+
exit 0
65+
;;
66+
esac
67+
68+
if [ -e "${LIBNAT20_BR_BUILD_DIR}" ]; then
69+
echo "Buildroot build directory ${LIBNAT20_BR_BUILD_DIR} already exists."
70+
exit 1
71+
fi
72+
73+
if [ ! -d "${LIBNAT20_ROOT}/examples/linux/br_external" ]; then
74+
echo "Directory ${LIBNAT20_ROOT}/examples/linux/br_external does not exist."
75+
echo "Please make sure \"${LIBNAT20_ROOT}\" points to the libnat20 root directory."
76+
exit 1
77+
fi
78+
79+
mkdir -p "${LIBNAT20_BR_BUILD_DIR}"
80+
pushd ${LIBNAT20_BR_BUILD_DIR}
81+
82+
echo "LIBNAT20_BR_BUILD_DIR=${LIBNAT20_BR_BUILD_DIR}" | tee .env
83+
echo "LIBNAT20_ROOT=${LIBNAT20_ROOT}" | tee -a .env
84+
85+
cp ${LIBNAT20_ROOT}/examples/linux/br_external/utils/envsetup.sh ./
86+
87+
# Checkout buildroot
88+
git clone --depth 1 --branch "2025.08.1" https://gitlab.com/buildroot.org/buildroot.git
89+
90+
# Install the buildroot config
91+
case "$PROJECT" in
92+
qemu)
93+
cp ${LIBNAT20_ROOT}/examples/linux/br_external/configs/qemu_br_defconfig buildroot/.config
94+
cp ${LIBNAT20_ROOT}/examples/linux/br_external/run-qemu.sh ./
95+
;;
96+
esac
97+
98+
pushd buildroot
99+
100+
make BR2_EXTERNAL=${LIBNAT20_ROOT}/examples/linux/br_external oldconfig
101+
102+
popd
103+
popd
104+
105+
echo
106+
echo "Now enter buildroot and run make:"
107+
echo " $ cd ${LIBNAT20_BR_BUILD_DIR}/buildroot"
108+
echo ' $ make'

0 commit comments

Comments
 (0)