Taking the pain out of downloading new docs

Twice a year, NXP releases a new Yocto-based BSP for their i.MX family of MPUs. A long, long time ago, the ~15 documents were available in a single zip file for easy downloads. But some time ago, NXP started to offer those archives only for earlier releases.
The latest release was only offered through individual downloads from an index page:

Downloading all the files in the left column leaves us with 15 PDFs
and an traffic accedent of hiding a document behind download
restrictions. We can safely remove the preDownload.html file and
consider the remaining ones. The User Guide (UG) and Reference
Manual (RM) Numbers are not very accessible, but fortunately they
carry proper metadata:
dzu@krikkit:~/doc/nxp/linux/L6.18.37_2.1.0$ ls
preDownload.html RM00285.pdf RM00294.pdf UG10159.pdf UG10164.pdf UG10166.pdf UG10168.pdf UG10215.pdf
RM00284.pdf RM00293.pdf RN00210.pdf UG10163.pdf UG10165.pdf UG10167.pdf UG10169.pdf uPower_USERS_GUIDE.pdf
dzu@krikkit:~/doc/nxp/linux/L6.18.37_2.1.0$ rm preDownload.html
So all we need to do to ease working with these documents, is to
symlink them to their human readable title as embedded in the PDFs.
The poppler-utils package exposes a pdfinfo tool, which is up to the
job. Iterating over the entries is trivial to do in a standard shell
script, which I named nxp-linux-symlink-docs:
dzu@krikkit:~/doc/nxp/linux/L6.18.37_2.1.0$ cat ../nxp-linux-symlink-docs
#!/bin/bash
pdf_title()
{
# Some titles span multiple lines, so only return first line
pdfinfo -meta $1 | xq -r '."x:xmpmeta"."rdf:RDF"."rdf:Description"."dc:title"."rdf:Alt"."rdf:li"."#text"' | head -1
}
for f in *.pdf
do
ln -s $f "$(pdf_title $f).pdf"
done
dzu@krikkit:~/doc/nxp/linux/L6.18.37_2.1.0$
Let's run this and see the results:
dzu@krikkit:~/doc/nxp/linux/L6.18.37_2.1.0$ ../nxp-linux-symlink-docs
dzu@krikkit:~/doc/nxp/linux/L6.18.37_2.1.0$ ls -l
nsgesamt 32776
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'EdgeLock Enclave Hardware Security Module API.pdf' -> RM00284.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'i.MX 8M Plus Camera and Display Guide.pdf' -> UG10168.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'i.MX 95x Camera Porting Guide.pdf' -> UG10215.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'i.MX Digital Cockpit Hardware Partitioning Enablement for i.MX.pdf' -> UG10169.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 "i.MX DSP User's Guide.pdf" -> UG10167.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 "i.MX Graphics User's Guide.pdf" -> UG10159.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'i.MX Linux Reference Manual.pdf' -> RM00293.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'i.MX Linux Release Notes.pdf' -> RN00210.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 "i.MX Linux User's Guide.pdf" -> UG10163.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 "i.MX Machine Learning User's Guide.pdf" -> UG10166.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'i.MX Porting Guide.pdf' -> UG10165.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'i.MX VPU Application Programming Interface Linux Reference.pdf' -> RM00294.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 "i.MX Yocto Project User's Guide.pdf" -> UG10164.pdf
-rw-rw-r-- 1 dzu dzu 1403717 25. Okt 23:13 RM00284.pdf
-rw-rw-r-- 1 dzu dzu 338984 25. Okt 23:14 RM00285.pdf
-rw-rw-r-- 1 dzu dzu 6193101 25. Okt 23:12 RM00293.pdf
-rw-rw-r-- 1 dzu dzu 1044753 25. Okt 23:13 RM00294.pdf
-rw-rw-r-- 1 dzu dzu 602964 25. Okt 23:12 RN00210.pdf
-rw-rw-r-- 1 dzu dzu 8258872 25. Okt 23:13 UG10159.pdf
-rw-rw-r-- 1 dzu dzu 1348506 25. Okt 23:12 UG10163.pdf
-rw-rw-r-- 1 dzu dzu 382253 25. Okt 23:13 UG10164.pdf
-rw-rw-r-- 1 dzu dzu 570463 25. Okt 23:13 UG10165.pdf
-rw-rw-r-- 1 dzu dzu 2077001 25. Okt 23:13 UG10166.pdf
-rw-rw-r-- 1 dzu dzu 1361126 25. Okt 23:13 UG10167.pdf
-rw-rw-r-- 1 dzu dzu 7979093 25. Okt 23:13 UG10168.pdf
-rw-rw-r-- 1 dzu dzu 305490 25. Okt 23:13 UG10169.pdf
-rw-rw-r-- 1 dzu dzu 404092 25. Okt 23:13 UG10215.pdf
lrwxrwxrwx 1 dzu dzu 11 25. Okt 23:14 'uPower API Reference Manual.pdf' -> RM00285.pdf
lrwxrwxrwx 1 dzu dzu 22 25. Okt 23:14 "uPower Firmware User's Guide.pdf" -> uPower_USERS_GUIDE.pdf
-rw-rw-r-- 1 dzu dzu 1193301 25. Okt 23:14 uPower_USERS_GUIDE.pdf
dzu@krikkit:~/doc/nxp/linux/L6.18.37_2.1.0$
Excellent! We can now easily access the documentation by looking at the titles. For me usually the i.MX Yocto Project User's Guide is the first thing that I look at to compile the new software stack.
Comments
Comments powered by Disqus