Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WOL] Implement wake on LAN command line tool #19206

Merged
merged 40 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9247507
Create sonic-nettools.mk
w1nda Jun 5, 2024
8c8a140
Create sonic-nettools.dep
w1nda Jun 5, 2024
2bdeb78
Create wol.cpp
w1nda Jun 5, 2024
4cbe616
Create Makefile
w1nda Jun 5, 2024
478a418
Update sonic-nettools.mk
w1nda Jun 5, 2024
776c821
Update sonic-nettools.mk
w1nda Jun 13, 2024
6a8c90e
Delete rules/sonic-nettools.dep
w1nda Jun 13, 2024
81c1df2
Create changelog
w1nda Jun 13, 2024
04c82fc
Create compat
w1nda Jun 13, 2024
0a6a858
Create control
w1nda Jun 13, 2024
1ffd10d
Create install
w1nda Jun 13, 2024
d9a8f12
Create rules
w1nda Jun 13, 2024
9846bf4
Create .gitignore
w1nda Jun 13, 2024
ad3eaea
Update Makefile
w1nda Jun 13, 2024
74652bf
Update Makefile
w1nda Jun 13, 2024
c713272
Update control
w1nda Jun 13, 2024
93d6056
Update sonic_debian_extension.j2
w1nda Jun 14, 2024
311bf11
Update slave.mk
w1nda Jun 14, 2024
7beb860
Merge branch 'sonic-net:master' into wol_in_cpp
w1nda Jun 20, 2024
73a0070
init rust env
w1nda Jun 20, 2024
deec91c
update makefile
w1nda Jun 20, 2024
3fcb673
update dockerfile
w1nda Jun 20, 2024
a93b6a7
update dockerfile
w1nda Jun 20, 2024
919c902
update dockerfile
w1nda Jun 21, 2024
5bdbc4b
update dockfile
w1nda Jun 21, 2024
7ff74e6
update dockerfile
w1nda Jun 21, 2024
5e3947f
update dockerfile
w1nda Jun 21, 2024
e3788f6
install libcap2-bin
w1nda Jun 21, 2024
a11beeb
update dockerfile
w1nda Jun 21, 2024
12e1c71
setcap
w1nda Jun 21, 2024
0274865
update wol
w1nda Jun 27, 2024
e3086dc
update test
w1nda Jun 27, 2024
0ee5bae
update tests
w1nda Jul 4, 2024
9c91688
update dockerfiles
w1nda Jul 4, 2024
e4fac7c
update dockerfiles
w1nda Jul 4, 2024
d50e136
update return code and output
w1nda Jul 8, 2024
7a07a74
update test
w1nda Jul 8, 2024
3d8cb11
update return code and output
w1nda Jul 9, 2024
7dc4c97
count and interval should specify both or neither
w1nda Jul 9, 2024
ef9bacc
update format
w1nda Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ sudo mkdir -p $FILESYSTEM_ROOT_USR_SHARE_SONIC_FIRMWARE/
# Keeping it generic. It should not harm anyways.
sudo mkdir -p $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM

# Install sonic-nettools
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-nettools_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
sudo setcap 'cap_net_raw=+ep' $FILESYSTEM_ROOT/usr/bin/wol

# Install a patched version of ifupdown2 (and its dependencies via 'apt-get -y install -f')
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ifupdown2_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
Expand Down
7 changes: 7 additions & 0 deletions rules/sonic-nettools.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SONIC_NETTOOLS_VERSION = 0.0.1-0

export SONIC_NETTOOLS_VERSION

SONIC_NETTOOLS = sonic-nettools_$(SONIC_NETTOOLS_VERSION)_$(CONFIGURED_ARCH).deb
$(SONIC_NETTOOLS)_SRC_PATH = $(SRC_PATH)/sonic-nettools
SONIC_DPKG_DEBS += $(SONIC_NETTOOLS)
10 changes: 10 additions & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,15 @@ CROSS_COMPILE_FLAGS := CGO_ENABLED=1 GOOS=linux GOARCH=$(GOARCH) CROSS_COMPILE=$

endif

ifeq ($(CROSS_BUILD_ENVIRON),y)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if you understand CROSS_BUILD_ENVIRON correctly.
Do you try to build arm SONiC image on amd64 machine?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm trying install toolchain if user want to do cross build.

ifeq ($(CONFIGURED_ARCH),armhf)
RUST_CROSS_COMPILE_TARGET = armv7-unknown-linux-gnueabihf
else ifeq ($(CONFIGURED_ARCH),arm64)
RUST_CROSS_COMPILE_TARGET = aarch64-unknown-linux-gnu
endif
export RUST_CROSS_COMPILE_TARGET
endif

###############################################################################
## Routing stack related exports
###############################################################################
Expand Down Expand Up @@ -1368,6 +1377,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
$(PYTHON_SWSSCOMMON) \
$(PYTHON3_SWSSCOMMON) \
$(SONIC_DB_CLI) \
$(SONIC_NETTOOLS) \
$(SONIC_RSYSLOG_PLUGIN) \
$(SONIC_UTILITIES_DATA) \
$(SONIC_HOST_SERVICES_DATA) \
Expand Down
14 changes: 14 additions & 0 deletions sonic-slave-bookworm/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install
git-buildpackage \
perl-modules \
libclass-accessor-perl \
libcap2-bin \
libswitch-perl \
libzmq5 \
libzmq3-dev \
Expand Down Expand Up @@ -655,6 +656,7 @@ RUN eatmydata apt-get install -y \
pps-tools:$arch \
libpam-cap:$arch \
libcap-dev:$arch \
libcap2-bin:$arch \
libpam0g-dev:$arch \
libaudit-dev:$arch \
libgtk-3-dev:$arch \
Expand Down Expand Up @@ -736,3 +738,15 @@ RUN eatmydata apt install -y python-is-python3
ARG bazelisk_url=https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-{{ CONFIGURED_ARCH }}
RUN curl -fsSL -o /usr/local/bin/bazel ${bazelisk_url} && chmod 755 /usr/local/bin/bazel
{% endif -%}

# Install Rust
ARG RUST_ROOT=/usr/.cargo
RUN RUSTUP_HOME=$RUST_ROOT CARGO_HOME=$RUST_ROOT bash -c 'curl --proto "=https" -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.79.0 -y'
{% if CROSS_BUILD_ENVIRON == "y" and CONFIGURED_ARCH == "armhf" %}
w1nda marked this conversation as resolved.
Show resolved Hide resolved
RUN mkdir -p /.cargo && $RUST_ROOT/bin/rustup target add armv7-unknown-linux-gnueabihf && echo "[target.armv7-unknown-linux-gnueabihf]\nlinker = \"arm-linux-gnueabihf-gcc\"" >> /.cargo/config.toml
{% endif -%}
{% if CROSS_BUILD_ENVIRON == "y" and CONFIGURED_ARCH == "arm64" %}
RUN mkdir -p /.cargo && $RUST_ROOT/bin/rustup target add aarch64-unknown-linux-gnu && echo "[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> /.cargo/config.toml
{% endif -%}
ENV RUSTUP_HOME $RUST_ROOT
ENV PATH $PATH:$RUST_ROOT/bin
3 changes: 3 additions & 0 deletions src/sonic-nettools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
bin/
.vscode/
Loading
Loading