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

Use firmware path from sysfs #12

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

minlexx
Copy link
Contributor

@minlexx minlexx commented Jan 8, 2024

Some linux distributions adjust path fro kernel to load firmware from using /sys/module/firmware_class/parameters/path. Kernel supports it, teach tqftpserv to respect it too.

Kernel supports only single firmware path specified in firmware_class path. In postmarketOS we created a service script msm-firmware-loader that runs in early boot stage and symlinks all firmware it can find on various device partitions into a single directory, which is then written into /sys/module/firmware_class/parameters/path.

With this patch tqftpserv is able, for example, to successfully serve wlanmdsp.mbn file when modem remoteproc is started.

$ sudo ./tqftpserv
[TQFTP] WRQ: /readwrite/server_check.txt (octet)
[TQFTP] RRQ: /readwrite/ota_firewall/ruleset (octet)
tqftpserv: failed to open ota_firewall/ruleset: No such file or directory
[TQFTP] unable to open /readwrite/ota_firewall/ruleset (2), reject
[TQFTP] RRQ: /readwrite/ota_firewall/ruleset (octet)
tqftpserv: failed to open ota_firewall/ruleset: No such file or directory
[TQFTP] unable to open /readwrite/ota_firewall/ruleset (2), reject
[TQFTP] RRQ: /readonly/firmware/image/wlanmdsp.mbn (octet)
[TQFTP] Remote returned an error: End of Transfer
[TQFTP] RRQ: /readonly/firmware/image/wlanmdsp.mbn (octet)
[TQFTP] Remote returned an error: End of Transfer
[TQFTP] RRQ: /readonly/firmware/image/wlanmdsp.mbn (octet)

Can be used to solve #7

translate.c Outdated Show resolved Hide resolved
translate.c Outdated Show resolved Hide resolved
@konradybcio
Copy link
Member

looks good at first sight, left some minor comments

@konradybcio konradybcio requested a review from lumag March 21, 2024 13:26
strcat(path, "/");
strcat(path, dirname(firmware_value));
strcat(path, "/");
strcat(path, file);
Copy link

Choose a reason for hiding this comment

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

This looks like a perfect usecase for asprintf

Copy link
Contributor Author

@minlexx minlexx Mar 23, 2024

Choose a reason for hiding this comment

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

asprintf/vasprintf is non-standard GNU/BSD extension and existing code around already uses strcpy/strcat everywhere. I can try though to use it here if you insist

Copy link

Choose a reason for hiding this comment

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

No, I don't.

Some linux distributions adjust path fro kernel to load
firmware from using /sys/module/firmware_class/parameters/path.
Kernel supports it, teach tqftpserv to respect it too.

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
@konradybcio konradybcio merged commit 37669ab into linux-msm:master Mar 27, 2024
@minlexx minlexx deleted the respect-firmware-sysfs-path branch April 13, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants