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

Copy .dtbo overlays from firmware repo as well #67

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Copy .dtbo overlays from firmware repo as well #67

merged 1 commit into from
Dec 15, 2023

Conversation

Doridian
Copy link
Contributor

Paired with gokrazy/firmware#309

@stapelberg
Copy link
Contributor

Thanks for the PR! Unfortunately, something does not seem to be right in the FAT writer (or between the packer and the FAT writer):

% gok -i dr overwrite --boot /tmp/boot.fat
% sudo mount -o loop /tmp/boot.fat /mnt/loop
% ls -l /mnt/loop/overlays 
total 60K
-r-xr-xr-x 1 root root  589 2023-12-13 08:55 act-led.dtbo
-r-xr-xr-x 1 root root 1,6K 2023-12-13 08:55 adafruit18.dtbo
-r-xr-xr-x 1 root root 2,3K 2023-12-13 08:55 adafruit-st7735r.dtbo
-r-xr-xr-x 1 root root 1,1K 2023-12-13 08:55 adau1977-adc.dtbo
-r-xr-xr-x 1 root root 1,6K 2023-12-13 08:55 adau7002-simple.dtbo
-r-xr-xr-x 1 root root 2,5K 2023-12-13 08:55 ads1015.dtbo
-r-xr-xr-x 1 root root 2,5K 2023-12-13 08:55 ads1115.dtbo
-r-xr-xr-x 1 root root 2,4K 2023-12-13 08:55 ads7846.dtbo
-r-xr-xr-x 1 root root 1,8K 2023-12-13 08:55 adv7282m.dtbo
-r-xr-xr-x 1 root root 2,3K 2023-12-13 08:55 adv728x-m.dtbo
-r-xr-xr-x 1 root root 1,4K 2023-12-13 08:55 akkordion-iqdacplus.dtbo
-r-xr-xr-x 1 root root 1,9K 2023-12-13 08:55 allo-boss2-dac-audio.dtbo
-r-xr-xr-x 1 root root 1,7K 2023-12-13 08:55 allo-boss-dac-pcm512x-audio.dtbo
-r-xr-xr-x 1 root root 1,2K 2023-12-13 08:55 allo-digione.dtbo
-r-xr-xr-x 1 root root 1,7K 2023-12-13 08:55 allo-katana-dac-audio.dtbo
-r-xr-xr-x 1 root root 1,0K 2023-12-13 08:55 allo-piano-dac-pcm512x-audio.dtbo
-r-xr-xr-x 1 root root 1,7K 2023-12-13 08:55 allo-piano-dac-plus-pcm512x-audio.dtbo
-r-xr-xr-x 1 root root 3,9K 2023-12-13 08:55 anyspi.dtbo
-r-xr-xr-x 1 root root 1,3K 2023-12-13 08:55 apds9960.dtbo
-r-xr-xr-x 1 root root 1,5K 2023-12-13 08:55 applepi-dac.dtbo
-r-xr-xr-x 1 root root 3,5K 2023-12-13 08:55 arducam-64mp.dtbo
-r-xr-xr-x 1 root root 3,0K 2023-12-13 08:55 arducam-pivariety.dtbo
% 

Only the first 22 overlays are included for some reason? I think we should fix that before merging the PR.

@Doridian
Copy link
Contributor Author

That is a very odd failure mode. I'll check it out tomorrow if I can see anything wrong.

@Doridian
Copy link
Contributor Author

Doridian commented Dec 13, 2023

@stapelberg I wonder if this is maybe an issue with the FAT16 writer itself? I haven't worked with FAT16 FS internals too much recently. Are we running out of space in the directory entry table or something?

Looking through the FAT file by hand with a hex editor, I can see that directory entries for the "missing" files are produced, but they seem to just not be correctly in the file table they belong...

@stapelberg
Copy link
Contributor

stapelberg commented Dec 14, 2023

@stapelberg I wonder if this is maybe an issue with the FAT16 writer itself? I haven't worked with FAT16 FS internals too much recently. Are we running out of space in the directory entry table or something?

Yes, I think that’s correct: https://github.com/gokrazy/internal/blob/a645001f8b93c7ebd600649287314b65fb0165b2/fat/writer.go#L554-L559 is hard-coded to one sector.

Let me see if I can fix that real quick.

Update: it’s not that quick a fix. I think we need to change the recursion in writeDir() so that we can write first, then allocate the corresponding fat entries. The problem is that the '..' directory entry in FAT needs to point to the parent directory’s cluster, so we either need to pre-calculate that or fix it afterwards.

stapelberg added a commit to gokrazy/internal that referenced this pull request Dec 15, 2023
This fixes writing out (for example) device tree overlay directory.

We now write the directory entries twice:
Once for figuring out the correct firstCluster values,
then again for writing out the correct firstCluster values.

related to gokrazy/gokrazy#216
related to gokrazy/tools#67
@stapelberg
Copy link
Contributor

OK, the large directory issue should be fixed with gokrazy/internal@cb94242

@stapelberg stapelberg merged commit 60c9d51 into gokrazy:main Dec 15, 2023
1 check passed
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.

2 participants