If you want to resizing the image won't work, unfortunately. I do have plans to make the scripts more robust - the biggest issue is that most SD cards aren't the full size they claim to be. A 16GB sdcard can be anywhere from 12-18GB in size.
What you'd want to do would be something like this:
Assuming your sdcard is /dev/sdc
Code:
dd if=/dev/zero of=/dev/sdc bs=1M count=4
parted /dev/sdc --script -- mklabel gpt
cgpt create -z /dev/sdc
cgpt create /dev/sdc
cgpt add -i 1 -t kernel -b 8192 -s 32768 -l U-Boot -S 1 -T 5 -P 10 /dev/sdc
cgpt add -i 2 -t data -b 40960 -s 32768 -l Kernel /dev/sdc
cgpt add -i 12 -t data -b 73728 -s 32768 -l Script /dev/sdc
cgpt add -i 3 -t data -b 106496 -s `expr $(cgpt show /dev/sdc | grep 'Sec GPT table' | awk '{ print \$1 }') - 106496` -l Root /dev/sdc
mkfs.ext2 /dev/sdc2
mkfs.ext4 /dev/sdc3
mkfs.vfat -F 16 /dev/sdc12
then you'd want to mount the image you've downloaded, as well as the sdcard partitions:
Code:
loopdevice=`losetup -f --show kali-1.0.6-chromebook.img`
device=`kpartx -va $loopdevice| sed -E 's/.*(loop[0-9])p.*/\1/g' | head -1`
device="/dev/mapper/${device}"
bootp=${device}p2
rootp=${device}p3
scriptp=${device}p12
mkdir -p /mnt/chromebookimg/{rootp,bootp,scriptp}
mount $bootp /mnt/chromebookimg/bootp
mount $rootp /mnt/chromebookimg/rootp
mount $scriptp /mnt/chromebookimg/scriptp
mkdir -p /mnt/sdcard/{rootp,bootp,scriptp}
mount /dev/sdc2 /mnt/sdcard/bootp
mount /dev/sdc3 /mnt/sdcard/rootp
mount /dev/sdc12 /mnt/sdcard/scriptp
You can just copy the contents across for bootp and scriptp, but you'll want to rsync the contents of rootp, so
Code:
cp -a /mnt/chromebookimg/scriptp/* /mnt/sdcard/scriptp/
cp -a /mnt/chromebookimg/bootp/* /mnt/sdcard/bootp/
rsync -HPavz /mnt/chromebookimg/rootp/* /mnt/sdcard/rootp/
The rsync command will take a while because it's syncing the files to the sdcard which will depend entirely on the speed of your sdcard and sdcard reader/writer.
Once they are done, run sync, and then unmount everything
Code:
sync
umount $bootp $rootp $scriptp /mnt/sdcard/{bootp,rootp,scriptp}
And finally, we need to write the bootloader to the sdcard's first partition, so you'll need to run
Code:
wget -O - http://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/nv_uboot-snow.kpart.bz2 | bunzip2 > nv_uboot-snow.kpart
dd if=nv_uboot-snow.kpart of=/dev/sdc1
sync
Once this is done, you should be able to pop the sdcard out and when you boot the chromebook, assuming you've already put it in developer mode, and run the command to enable booting from usb, hit ctrl+u with the sdcard plugged in.