Skip to content

Commit ca664f3

Browse files
authored
Add libnat20 as buildroot package to the linux example. (#103)
This adds libnat20 to the example buildroot environment. It is a dependency for developing nat20 userspace tools.
1 parent dd23eca commit ca664f3

6 files changed

Lines changed: 107 additions & 1 deletion

File tree

.github/workflows/linux-kmod-build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,17 @@ jobs:
138138
find ${{ runner.temp }}/buildroot.build -name 'nat20sw.ko' | grep -q nat20sw.ko
139139
echo "nat20sw.ko built successfully:"
140140
find ${{ runner.temp }}/buildroot.build -name 'nat20sw.ko' -exec ls -la {} \;
141+
142+
- name: Build libnat20 userspace library
143+
env:
144+
LIBNAT20_OVERRIDE_SRCDIR: ${{ github.workspace }}
145+
run: |
146+
cd ${{ runner.temp }}/buildroot.build/buildroot
147+
make libnat20-dirclean
148+
make libnat20 -j $(( $(nproc) + 1 ))
149+
150+
- name: Verify libnat20 was produced
151+
run: |
152+
find ${{ runner.temp }}/buildroot.build -name 'libnat20.a' | grep -q libnat20.a
153+
echo "libnat20.a built successfully:"
154+
find ${{ runner.temp }}/buildroot.build -name 'libnat20.a' -exec ls -la {} \;

examples/linux/br_external/Config.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ source "$BR2_EXTERNAL_NAT20_PATH/package/nat20crypto/Config.in"
3737
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20device/Config.in"
3838
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20sw/Config.in"
3939
source "$BR2_EXTERNAL_NAT20_PATH/package/nat20lib/Config.in"
40+
source "$BR2_EXTERNAL_NAT20_PATH/package/libnat20/Config.in"

examples/linux/br_external/configs/qemu_br_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3980,3 +3980,4 @@ BR2_PACKAGE_NAT20CRYPTO=y
39803980
BR2_PACKAGE_NAT20DEVICE=y
39813981
BR2_PACKAGE_NAT20SW=y
39823982
BR2_PACKAGE_NAT20LIB=y
3983+
BR2_PACKAGE_LIBNAT20=y
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
config BR2_PACKAGE_LIBNAT20
37+
bool "libnat20"
38+
help
39+
Add the libnat20 DICE library
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
# In CI LIBNAT20_OVERRIDE_SRCDIR is set to the root of the repository,
37+
# so that the source under test is always the current branch.
38+
# Integrators who use this configuration should pin the version
39+
# to a specific commit or branch to avoid breakages when the main branch changes.
40+
LIBNAT20_VERSION = origin/main
41+
LIBNAT20_SITE = https://github.com/aurora-opensource/libnat20.git
42+
LIBNAT20_SITE_METHOD = git
43+
LIBNAT20_LICENSE = Apache-2.0 OR GPL-2.0
44+
LIBNAT20_LICENSE_FILES = LICENSE-Apache-2.0.txt LICENSE-GPL-2.0.txt
45+
46+
LIBNAT20_INSTALL_STAGING = YES
47+
LIBNAT20_INSTALL_TARGET = NO
48+
49+
$(eval $(cmake-package))

examples/linux/br_external/utils/envsetup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export NAT20CRYPTO_OVERRIDE_SRCDIR="$LIBNAT20_ROOT"
5050
export NAT20SW_OVERRIDE_SRCDIR="$LIBNAT20_ROOT"
5151
export NAT20DEVICE_OVERRIDE_SRCDIR="$LIBNAT20_ROOT"
5252
export NAT20LIB_OVERRIDE_SRCDIR="$LIBNAT20_ROOT"
53+
export LIBNAT20_OVERRIDE_SRCDIR="$LIBNAT20_ROOT"
5354

5455
function ensure_popd() {
5556
"$@"
@@ -72,6 +73,7 @@ function brrebuild() {
7273
echo " all - Rebuild all components"
7374
echo " linux - Rebuild the linux kernel"
7475
echo " nat20crypto - Rebuild the nat20crypto module"
76+
echo " libnat20 - Rebuild the libnat20 library"
7577
echo " nat20device - Rebuild the nat20device module"
7678
echo " nat20sw - Rebuild the nat20sw module"
7779
echo " nat20lib - Rebuild the nat20lib library"
@@ -81,7 +83,7 @@ function brrebuild() {
8183

8284
case "$1" in
8385
all)
84-
ensure_popd make linux-rebuild nat20lib-rebuild nat20crypto-rebuild nat20device-rebuild nat20sw-rebuild all
86+
ensure_popd make linux-rebuild nat20lib-rebuild nat20crypto-rebuild nat20device-rebuild nat20sw-rebuild libnat20-rebuild all
8587
;;
8688
*)
8789
ensure_popd make $1-rebuild all

0 commit comments

Comments
 (0)