Here how I did to install all MagicLantern tools on my Lion system with homebrew instead of macport (too many failed port for having all working).
Basic Utilities[]
NOTE: you can skip a lot of step using the prepare.Lion.sh script (post feedback please) We first need to install some basic utilities to be able to have all things working.
- XCode4 (NOTE: XCode 4.3: Command Lines Tools is now an optional install. You’ll need to enable under Preferences > Downloads.)
- downloadable from AppStore here .
- Homebrew (to install various packages easily)
- from Terminal use this code to install it:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Downloading Magic Lantern source and tools[]
To have the most updated version for scripts and tools, and to be able to compile ML first we need to get the source code using mercurial.
From Terminal install mercurial with homebrew and then download the sources in home dir:
brew install mercurial;
cd ~/;
hg clone https://bitbucket.org/hudson/magic-lantern;
-or-
Install mercurial from the link here: /http://mercurial.selenic.com/
Summon Arm toolchain install[]
To use the summon arm toolchain script from ML something has to be installed:
- The libusb package for Lion from here: (direct download) or with terminal:
curl -O http://www.ellert.se/PKGS/libusb-2011-10-29/10.7/libusb.pkg.tar.gz
tar -xvf libusb.pkg.tar.gz
sudo installer -pkg libusb.pkg -target /
- Ad then some other stuff with homebrew:
brew install binutils gmp mpfr libmpc wget
- Now it's time to start the summon arm script:
cd ~/magic-lantern/toolchain/; sudo summon-arm;
Wait until finished.
Lion Compliling Issue[]
You need to make some changes to ~/magic-lantern/src/Makefile.inc to compile on Lion (a patch is ready but needs more tester).
add -mlong-calls\ under CFLAGS=\
Example:
CFLAGS=\ $(FLAGS) \ -Os \ -Wall \ -W \ -mstructure-size-boundary=32 \ -Wno-unused-parameter \ -Wno-implicit-function-declaration \ -Wno-unused-function \ -Wno-missing-field-initializers \ -Wno-format \ -std=gnu99 \ -D__ARM__ \ -I$(PLATFORM_INC) \ -I$(SRC_DIR) \ -mlong-calls\
Compiling Magic Lantern options[]
After the toolchain is installed you can compile ML for a specific camera with:
cd ~/magic-lantern/; make 600D;
for the 600D.
After compilation you will find your autoexec.bin in ~/magic-lantern/platform/600D.102/ for example.
Other options are:
all : to make an autoexec.bin that supports all models;
clean : to remove some stuff used in previous compiling;
zip : to make a full zip with all needed stuff not only the autoexec.bin
Make a card bootable[]
Format the card with the camera (needs to be called EOS_DIGITAL) and then use this as script from your mac:
#! /bin/bash # patch the SD/CF card bootsector to make it bootable on Canon DSLR # See http://chdk.setepontos.com/index.php/topic,4214.0.html # http://en.wikipedia.org/wiki/File_Allocation_Table#Boot_Sector # change this on linux dev=/dev/sdb1 # Fix for osx, auto detects the card if formatted incamera before using this script if [[$OSTYPE == darwin* ]]; then dev=/dev/$(diskutil list | grep EOS_DIGITAL | awk '{print $6}' ) echo $dev diskutil unmount $dev fi # read the boot sector to determine the filesystem version DEV32=`dd if=$dev bs=1 skip=82 count=8` DEV16=`dd if=$dev bs=1 skip=54 count=8` if [ "$DEV16" != 'FAT16 ' -a "$DEV32" != 'FAT32 ' ]; then echo "Error: "$dev" is not a FAT16 or FAT32 device" echo "Format your card in camera before using this script on Osx" echo debug $dev $DEV16 $DEV32 exit fi if [ "$DEV16" = 'FAT16 ' ]; then offset1=43 offset2=64 FS='FAT16' elif [ "$DEV32" = 'FAT32 ' ]; then offset1=71 offset2=92 FS='FAT32' else echo "Error: "$dev" is not a FAT16 or FAT32 device" exit fi echo "Applying "$FS" parameters on "$dev" device:" echo " writing EOS_DEVELOP at offset" $offset1 "(Volume label)" echo EOS_DEVELOP | dd of="$dev" bs=1 seek=$offset1 count=11 echo " writing BOOTDISK at offset" $offset2 "(Boot code)" echo BOOTDISK | dd of="$dev" bs=1 seek=$offset2 count=8
422 to JPG conversion with Phyton script [DRAFT][]
To be able to use the 422-jpg.py script we need numpy and PIL:
cd ~/magic-lantern/; #go to ML source folder
wget https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh; #download installer script for numpy
sudo bash install_superpack.sh; #install numpy
brew install pil; #install PIL
Cropmarks .bmp to RLE compression [DRAFT][]
to be added.
Ruby script
#!/usr/bin/env ruby if ARGV.count!=1 then puts "Usage: "+__FILE__+" [filename]" exit end File.open(ARGV[0],"rb") do |f| File.open(ARGV[0]+".rle","wb+") do |out| sign = f.read(2) header = f.read(52).unpack("V*") palette = nil palette = f.read(header[2]-54) if header[2]-54>0 data = f.read(header[8]).unpack("C*") width = header[4] height = header[5] newdata = [] count = 0 color = 0 x = 0 data.each do |d| if x==0 then color = d count = 0 end if d == color and count<255 then count+=1 else newdata << count newdata << color count = 1 color = d end x+=1 if x==width then x = 0 newdata << count newdata << color newdata << 0 newdata << 0 end end newdata << 0 newdata << 1 header[0] = newdata.length + 54 + (palette.nil? and 0 or palette.length) header[7] = 1 #set compression to RLE8 header[8] = newdata.length out.print "BM" out.print header.pack("V*") out.print palette unless palette.nil? out.print newdata.pack("C*") end end
HDR Photo fusion with enfuse [DRAFT][]
- Install enfuse/enblend for mac download here;
- or use terminal:
- wget http://downloads.sourceforge.net/project/enblend/enblend-enfuse/enblend-enfuse-4.0/enblend-enfuse-4.0-mac.tar.gz;
tar xvfz enblend-enfuse-4.0-mac.tar.gz; cp enblend-enfuse-4.0-mac/enfuse /usr/bin/; cp enblend-enfuse-4.0-mac/enblend /usr/bin/;
- Use the script in the card
- (to be added more info).
HDR Video workflow (with enfuse and mplayer) [DRAFT][]
- If you don't have yet done it (for photo HDR fusion), install enfuse/enblend for mac download here;
- Install mplayer:
brew install mplayer;
- Copy the video in a folder and use this as script to convert it (by Ro-Man from Vimeo ML group )
#!/bin/bash processFrames() { noframes=`ls *.png | wc -l` echo "$noframes frames extracted..." n=0 for i in `seq 1 2 $noframes`; do in1=`printf "%08d.png" "$i"` in2=`printf "%08d.png" "$((i+1))"` out=`printf "out%08d.jpg" "$n"` echo "creating HDR frame $out from $in1 and $in2 ..." enfuse --compression=95 -o $out $in1 $in2 let n++ done rm *.png } encodeVideo() { # 2 stage encoding with mpreg4 codec, settings from mencoder wiki # optimal_bitrate = (40..60) * 25 * width * height / 256 opts="vbitrate=12150000:mbd=2:keyint=132:v4mv:vqmin=3:vlelim=-4:vcelim=7:lumi_mask=0.07:dark_mask=0.10:naq:vqcomp=0.7:vqblur=0.2:mpeg_quant" mencoder mf://./out*.jpg -mf w=1920:h=1080:fps=15:type=jpg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:$opts -o /dev/null mencoder mf://./out*.jpg -mf w=1920:h=1080:fps=15:type=jpg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:$opts -o output.avi rm out*.jpg } mplayer -vo png:z=1 $1 processFrames encodeVideo exit