-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add script to write the serial print into a log file. #227
base: master
Are you sure you want to change the base?
Conversation
bb812c2
to
a3e00cb
Compare
a3e00cb
to
77cbdae
Compare
Description=Serial Logger Service | ||
|
||
[Service] | ||
ExecStart=/usr/local/bin/log-serial.py /var/log/openmmc-serial.log /dev/serial/by-id/%i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log file should also be parametrized with %i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should add usage of disable-jtag
somewhere, right? Or since it doesn't work, should we avoid merging it for now?
#!/bin/bash | ||
|
||
# Check if a serial port argument is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <serial_port>" | ||
exit 1 | ||
fi | ||
|
||
SERIAL_PORT=$1 | ||
|
||
SCRIPT_PATH="log-serial.py" | ||
SERVICE_TEMPLATE="[email protected]" | ||
SERVICE_PATH="/usr/local/lib/systemd/system/[email protected]" | ||
BIN_PATH="/usr/local/bin/log-serial.py" | ||
|
||
cp "$SCRIPT_PATH" "$BIN_PATH" | ||
cp "$SERVICE_TEMPLATE" "$SERVICE_PATH" | ||
|
||
systemctl enable --now "log-serial@${SERIAL_PORT}.service" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should store this install script, and possibly everything else, in bpm-app
, instead of here.
These files are useful for all crates, and it's easier to pull scripts from a single repository than hunting for all necessary ones.
disable-jtag: disable-jtag.c | ||
gcc -Wall -Wextra -O2 -o disable-jtag disable-jtag.c -lftdi | ||
|
||
clean: | ||
rm -f disable-jtag | ||
|
||
.PHONY: all clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disable-jtag: disable-jtag.c | |
gcc -Wall -Wextra -O2 -o disable-jtag disable-jtag.c -lftdi | |
clean: | |
rm -f disable-jtag | |
.PHONY: all clean | |
CFLAGS = -Wall -Wextra -O2 | |
LDLIBS = -lftdi | |
EXE = disable-jtag | |
.PHONY: all clean | |
all: $(EXE) | |
clean: | |
rm -f $(EXE) |
We can use automatic rules here, instead of specifying our own. Even if we couldn't, we should never use gcc
in a rule, use $(CC)
; and rules shouldn't repeat their parameters, they should use $@
, $^
and $<
, and ideally they should also be more generic. Example of such a rule:
%: %.c
$(CC) $(CFLAGS) -o $@ $< $(LDLIBS)
.PHONY
declared all
but it didn't exist.
No description provided.