Closed mauritiusdadd closed 8 years ago
Why not depend on the existing pbzx stream parser, rather than bundle our own python implementation?
I'm not a fan of bundling dependencies, especially if they're for helper scripts. Downstream packagers can deal with dependency issues themselves.
Well I thought it would have been easier having a pbzx parser bundled into the repo, but if @patjak thinks it's better relying on an external dependency I'll update the script to use the latter.
Well, @wvengen in #14 did a great job by figuring out which bytes must be retrieved from the remote file in order to get the kext file and his method does not require nor xar neither pbxz. What do you think? Shall we use his script to download the driver?
Running make
on Ubuntu 15.10 gives
Error: No download agent found, use --help for more information.
even though I have both curl
and wget
installed, so the download agent detection logic seems to be flawed.
You could just comment out the whole section and set the variable to wget, but i'd suggest using the other firmware download method from here https://github.com/patjak/bcwc_pcie/issues/14#issuecomment-167446787
I am running 15.10 as well, succeeded to install the driver yesterday quite easily:
extract_from_osx.sh
and run it to extract firmware.bin.I think this Pull Request can be cancelled and improved a bit. It works, but because it was not merged in time, there are few improvements floating around.
On Ubuntu Trusty which ships GNU bash, Version 4.3.11(1)-release (x86_64-pc-linux-gnu) you need to deal with the array like that:
index 11d595f..ea74435 100755
--- a/firmware/download-osx.sh
+++ b/firmware/download-osx.sh
@@ -68,7 +68,7 @@ download()
msg "Downloading the .dmg file..."
if [[ -z "$DLOAD_AGENT" ]]; then
msg2 "Cheching for available download agents..."
- for agent in $agents; do
+ for agent in ${agents[@]}; do
if which "$agent" &> /dev/null; then
msg2 "Found '$agent'"
DLOAD_AGENT="$agent"
@ockham Simply change "for agent in $agents do" to " for agent in ${agents[@]}; do".
BTW: ubuntu trusty doen't ship 'xar', but 7zip-full can process the xar format as well. I would opt to drop the requirement for 'xar', because 7zip (full) is already required.
diff --git a/firmware/extract-firmware.sh b/firmware/extract-firmware.sh
index 02c35c8..0c1c962 100755
--- a/firmware/extract-firmware.sh
+++ b/firmware/extract-firmware.sh
@@ -114,7 +114,6 @@ checkPrerequisites()
hasProgram "python2"
hasProgram "sha256sum"
hasProgram "tail"
- hasProgram "xar"
}
getCheckSum()
@@ -194,7 +193,7 @@ decompress_dmg()
rm -f "5.hfs"
msg2 "Uncompressing XAR archive..."
- xar -x -f "OSXUpd.xar"
+ 7z x -y "OSXUpd.xar"
rm -f "OSXUpd.xar"
@derjohn Thanks for your suggestions! I've also noticed that xar
is unavailable on Ubuntu, and that 7z
is able to process .xar
files. (So can xzcat
, it seems btw.)
However, I'd agree with @Jancis that https://github.com/patjak/bcwc_pcie/issues/14#issuecomment-167446787 is probably the way to go :-)
Ok, I like the @wvengen way too so I'm going to replace the download script, but I want to keep the ability to decompress the whole .dmg
file, just in case.
@ockham: I would like remove as many dependencies as I can, but for me 7z
does not work with .xar
files, it tries to decompress the archive but then I only get a file named Payload~
of 512 bytes and xzcat
just says the archive format is not recognized :confused:
Just for the sake of the record:
.dmg
file. I also removed the download script and emended the @wvengen code directly into the makefile. Now if you run make
, it will fetch and decompress only the AppleCameraInterface
kext file and then extract the firmware from it. If the kext file is already present it will not be re-downloaded, but you can force the re-download by calling directly make AppleCameraInterface
or by removing it using make clean
.DESTDIR
to change the prefix of the installation: for example make install DESTDIR="$pkgdir"
will install the firmware in $pkgdir/urs/lib/firmware/facetimehd/
.Thanks, looks good!
@ockham: I would like remove as many dependencies as I can, but for me
7z
does not work with.xar
files, it tries to decompress the archive but then I only get a file namedPayload~
of 512 bytes andxzcat
just says the archive format is not recognized :confused:
Hmm, depending on xar
really is kind of a bummer on Ubuntu. Can you combine xzcat
with cpio
and dd
like @wvengen did in #14? (Or maybe you can advise, @wvengen?)
@ockham not sure what make xar
a pain in ubuntu, fwiw bsdtar
handles the xar files just fine and should work on the cpios also, would cut down on the number of dependencies.
Nice point about bsdtar
. Nevertheless, extracting the xar archive is only needed when the partial download (which is the default method) doesn't work - so perhaps this isn't such an issue at all.
I would say, though, that the fallback method is more likely to work when it extracts the xar archive by unpacking it properly (instead of using offsets) - consider the unlikely case of Apple of changing the dmg.
This seems to work fine now. Thanks!
As I previously said in #23 and with the information in #14, I made a script that downloads the OS X
.dmg
file, extracts theAppleCameraInterface
kext file and from it extracts the firmware of the camera. I added also aMakefile
so everything one needs to do is to runmake
to download a extract the firmware and the runmake install
to install the firmware in/usr/lib/firmware/facetimehd/
.