Commit Graph

733 Commits

Author SHA1 Message Date
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
Leah Rowe 00cafd7022 download/coreboot: fix misnamed function 2023-05-15 02:39:29 +01:00
Leah Rowe 86512e84be download/coreboot: simplify small if statements 2023-05-15 02:38:22 +01:00
Leah Rowe d28584f3d0 download/coreboot: fetch config in new function 2023-05-15 02:30:14 +01:00
Leah Rowe 162f4bf5dd download/coreboot: use global variables
i'm going to move the config recursion check
into a separate function, and global variables
make it easier to handle
2023-05-15 02:17:39 +01:00
Leah Rowe 56b80c0a4c download/coreboot: rename function for clarity 2023-05-15 01:25:08 +01:00
Leah Rowe ee79d8ba95 download/coreboot: reduce indentation in loop 2023-05-15 01:21:20 +01:00
Leah Rowe f858baea93 download/coreboot allow downloading specific trees
this fixes a regression caused in previous (recent)
revisions. this script is a beast, and requires a
lot of taming, which is the purpose of my audit
2023-05-15 01:12:37 +01:00
Leah Rowe a33e5c67f3 download/coreboot: split config check to function 2023-05-15 01:07:32 +01:00
Leah Rowe 62038f1d03 download/coreboot: fix misnamed variable 2023-05-15 00:47:31 +01:00
Leah Rowe 342e846f28 download/coreboot: consistent function declaration 2023-05-15 00:44:26 +01:00
Leah Rowe c32ae5979f download/coreboot: rename function for clarity 2023-05-15 00:43:55 +01:00
Leah Rowe e47aaa8ff0 download/coreboot: prune errant comments 2023-05-15 00:42:36 +01:00
Leah Rowe 31d8fcd3fd download/coreboot: split main() 2023-05-15 00:40:54 +01:00