Commit Graph

546 Commits (82c4d7b280f9f38c7e46afc4bfa26365d0083e21)

Author SHA1 Message Date
Leah Rowe 82c4d7b280 .gitcheck clean: clean coreboot directories too
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:44:11 +01:00
Leah Rowe 0f3c3ca600 .gitcheck: reduce indentation level for loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:42:06 +01:00
Leah Rowe ecd7f1d11e .gitcheck: move logic out of main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:41:00 +01:00
Leah Rowe 829bc02bf2 .gitcheck: *actually* check coreboot directories 2023-05-18 09:38:20 +01:00
Leah Rowe 52bc07bc84 .gitcheck: improved coding style
main() on top

top-down order of logic

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:35:26 +01:00
Leah Rowe 83235fb96b .gitcheck: check argv when running gitcheck-clean
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:25:25 +01:00
Leah Rowe 6ce77652c6 .gitcheck: actually *run* gitcheck-clean
Run() is called, but without argument.

This patch fixes that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:23:23 +01:00
Leah Rowe 8782bff8ef download: code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:18:42 +01:00
Leah Rowe a232f9c575 download: check for non-existent script in loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:16:50 +01:00
Leah Rowe b4f1804e48 download script: bugfix: gitcheck clean didn't run
the "placeholder" git credentials were not being
wiped, which sometimes overwrites the user's git
credentials permanently, when working on lbmk

(permanently, until manually reset by the user)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:12:27 +01:00
Leah Rowe 62c88dfb6e download script: improved coding style
introduce main()

cleaned up the if/else block

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:11:59 +01:00
Leah Rowe 5b59490928 util/spkmodem_recv: Use pledge but only on OpenBSD
It will only be used on OpenBSD. Other operating
systems will behave in the same way.

Pledge is feature specific to OpenBSD that
restricts system operations, for security:

https://man.openbsd.org/pledge.2

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 25241ae222 util/spkmodem_recv: Add -u flag (no line buffer)
printf outputs to stdout, which is line buffered
by default.

Adding a -u option to disable buffering.

Exit when a non-support flag is given, but adhere
to current behaviour when no flag is given.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 01fdfa3ab6 util/spkmodem_recv: Tidy up global variables
They do not need to be initialised zero, because
global variables are always zero by default,
unless set differently by the programmer.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 50b35939de util/spkmodem_recv: Make pulse variable global
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 14190de9e8 util/spkmodem_recv: Use parentheses on comparisons
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe c0f2bf3077 util/spkmodem_recv: Move global variable: pulse
It is only used by a single function.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 5d03598b99 util/spkmodem_recv: Purge unused global: amplitude
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 63e43819b3 util/spkmodem_recv: Remove unused variable: pos
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe a0abcb9f53 util/spkmodem_recv: Re-order functions for clarity
print_char() is referenced last, so declare it last.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 93cc664254 util/spkmodem_recv: Handle output in new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 27866e65fb util/spkmodem_recv: Re-order prototypes
Put them in the same order as declared.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 8b851258e2 util/spkmodem_recv: Rename functions for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 6c1bf756d3 util/spkmodem_recv: Return errno in main
This is a good general practise, to catch errors.

Any errors found can then be handled in code.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe c23806e1f6 util/spkmodem_recv: Use correct printf specifier
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 0cc23b2363 util/spkmodem_recv: Add error handling
There was literally no error handling before.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 179323819b util/spkmodem_recv: Move logic out of main
Main should only be a skeletal structure.

Actual logic should always be handled externally.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 3d55429443 util/spkmodem_recv: Rename variable for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 697ae5e2ca util/spkmodem_recv: Remove use of static keyword
It is entirely superfluous in this program.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 2c12e70cfe util/spkmodem_recv: Rename variable for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 5b6f5cb06b util/spkmodem_recv: Remove space in function calls
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe abc5cfd38c util/spkmodem_recv: Say frame in English
Source code should be written in English.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe e286470432 util/spkmodem_recv: Top-down logic (main on top)
Add the appropriate prototype.

Top-down function order is easier to read.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 3722c1e67a util/spkmodem_recv: simplified pulse check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 88683b767b util/spkmodem_recv: Define argc/argv in main
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 83b34e2f48 util/spkmodem_recv: Reduced indentation in loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 22633e0dc0 util/spkmodem_recv: Use tabs for indentation
The GNU indentation style is hard to read.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 9152d0f939 util/spkmodem_recv: Add clean to the Makefile
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 754410f2af util/spkmodem_recv: Define CC in the Makefile
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe f2887e9b45 util/spkmodem_recv: Add strict CFLAGS
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe b496ead7b3 util/spkmodem_recv: Import from coreboot
Imported from util/spkmodem_recv at coreboot
revision:

e70bc423f9a2e1d13827f2703efe1f9c72549f20

This is a client for spkmodem, to allow serial
console via PC speaker.

I've decided to import it in lbmk, because I
heavily modified it. The patches will be
applied next.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:09:42 +01:00
Leah Rowe 52d87f5f08 download/coreboot: minor code cleanup
i'm pretty much finished now

there might be a few more changes later,
like stricter error handling, more verbose
error messages, etc

right now, it relies on -e to kill lbmk
on error, and uses the exit command

another planned change it to support
other upstreams besides coreboot.org,
such as the dasharo codebase

the latter is *why* i refactored this
download script, for asus kgped-d16
2023-05-15 05:01:48 +01:00
Leah Rowe 7bd206b9e7 download/coreboot: remove errant code
the build_error file is obsolete
2023-05-15 04:53:14 +01:00
Leah Rowe bd82d90faf download/coreboot: tidy up variable names 2023-05-15 04:44:47 +01:00
Leah Rowe 66d06afd6c download/coreboot: run extra.sh from cbtree
to my knowledge, this feature has never been used,
but lbmk permits resources/coreboot/boardname/extra.sh
to execute, as provided by the maintainer, with working
directory set to: coreboot/boardname

this could be used to extend lbmk in a number of ways

for example, it could be used to patch 3rdparty/

it could also be used to break coreboot in creative
and novel ways. hint hint.
2023-05-15 04:17:50 +01:00
Leah Rowe c4b0825c5e download/coreboot: avoid variable conflict
the "board" variable in prepare_new_coreboot_tree()
is also declared in fetch_coreboot_trees

for the one in prepare_new_coreboot_tree, it's passed
as an argument to the function, so give it a new name

i learned that some shells have a global scope, when
using variables of the same name between functions
2023-05-15 04:14:50 +01:00
Leah Rowe 0e1e9c1773 download/coreboot: fix downloads without argument
this should download all trees:

	./download coreboot

without this patch, it doesn't

with this patch, it works

i overlooked this during earlier
refactoring. auditing revealed it.
2023-05-15 04:11:10 +01:00
Leah Rowe bea6735395 download/coreboot: much cleaner coding style
top-down order, and *still* rfc 3676 compliant

i finished simplifying the logic, and
i split everything into smaller functions

there is still more more polishing to do

final touches will be done in new revisions
2023-05-15 04:05:27 +01:00
Leah Rowe 2d69072a09 download/coreboot: clone upstream via ./gitclone
coreboot trees/patching is still handled
specifically by "./download coreboot"

command now available in lbmk:

./gitclone coreboot

this *only* creates the directory at:
coreboot/coreboot

this directory is never used in builds.
it is only used by download/coreboot to
create patched trees for each mainboard
2023-05-15 03:24:19 +01:00
Leah Rowe c17423e475 download/coreboot: simplify check 2023-05-15 02:51:15 +01:00