cloud goes social

Icon

computer, travel, movies, music, cuisine and more

ImageMagick, Xcode4, iOS4.3

Hi all!

Just a small update on the ImageMagick front! First of all, a reminder. All my ImageMagick related efforts (compiler script + test project) can be found over at github.

The latest ImageMagick, at the time of writing is version 6.6.8-5. I’ve bumped the versions of the delegate libraries, as well:

  • jpeg: 8-c
  • png: 1.4.5
  • tiff: 3.9.4

Finally I’ve got my hands on the latest Xcode4 and on the latest iOS4.3 SDK. I’ve updated the IM_Test Xcode project on the same git repository of the compiler script :)

You can always grab the pre-compiled versions from ImageMagick’s FTP stite

I hope everyone is happy about the update, if you are let me know what you’re up to with ImageMagick on the iPhone and if you feel like don’t hesitate in donating (link on the right), as you can see this blog runs ads-free and any bit helps!

Cheers!

~C

Android kernel compilation, detailed instructions

Disclaimer

I am not responsible if anything goes bad. Ever. In particular if your devices will be unusable after following this tutorial! Mine didn’t :)

Introduction

I’ve recently been involved in making some changes to the Linux kernel. Not any Linux kernel but the Android Linux Kernel. I’ll share what I believe is a pretty good workflow for everyone interested in playing with it both on a NexusOne (with the stock OS, i.e. WITHOUT CyanogenMod) and on a HTC Magic (with CyanogenMod installed). They are quite similar scenarios, and many others have been writing about it. I always had to change a few things from others descriptions and therefore here I report what I found to be a working solution for the latest patched updated versions. This is an aggregation work of others spread all around the interwebs. I like things accessible in one place :)

Throughout this “tutorial” I will be assuming that you are working on a Linux environment (i.e. Ubuntu). Furthermore I work on a 32-bit system, if you are not in this situation try it out, but further changes might be needed.

Preliminary Settings

Let’s start with having all the necessary software which we will need later installed and operative. If you are already an Android and/or a Kernel developer you most probably have this already done. Skip this section.

  1. adb is needed. Install the latest Android SDK – I personally install it in
    ~/Bin/android-sdk-linux_x86

    Remember to add the tools/ directory to your $PATH variable.

  2. ndk is needed. Install the latest Android NDK – I personally install it in
    ~/Bin/android-ndk-VERSION

    For example the latest is version r5 and the directory will be:

    ~/Bin/android-ndk-r5

    . Remember then to add the toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin directory that is present inside the ndk to your $PATH variable.

  3. fastboot is needed. Grab it and download it inside your sdk/tools directory or anywhere that is in your $PATH
  4. Software is needed. Install it.
    apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
    

    If you are on a 64-bit machine also install:

    apt-get install ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
    

In the end your ~/.bash_profile, ~/.bash_rc, … would look along the lines of:

export PATH="~/Bin/android-sdk-linux_x86/tools:~/Bin/android-ndk-r5/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin:${PATH}"

Now let’s dwell into the interesting things. First of all have your directory structure well planned ahead. Or you will end up losing a lot of time just remembering what is what.

mkdir ~/android
mkdir ~/android/bootimg_builder
cd ~/android

Now we clone the git repositories for the Google kernel and for the CyanogenMod kernel. We will have two directories with the sources for the two kernels: cm-kernel and google-kernel

git clone git://github.com/CyanogenMod/cm-kernel.git cm-kernel
git clone git://android.git.kernel.org/kernel/msm.git google-kernel

This is where I will first go into explaining the procedure for the HTC Magic with CyanogenMod installed and afterwards I will explain how to make it work for the NexusOne.

HTC Magic with CyanogenMod

Let’s start by switching to our own branch, in case we want to modify anything and keep track of the changes without polluting the master branch. The latest CyanogenMod (6.1) uses the kernel version 2.6.35, we keep on using that.

cd cm-kernel
git checkout -b personal_branch origin/android-msm-2.6.35-froyo-stable

Now we need to pull the configuration file off from the device, have it plugged to the PC through the USB port.

adb pull /proc/config.gz config.gz
gunzip config.gz && mv config .config

Now we update the .config that will be used while compiling the kernel.

ARCH=arm CROSS_COMPILE=arm-eabi- make oldconfig
ARCH=arm CROSS_COMPILE=arm-eabi- make menuconfig

The last command will open up an interactive menu. Change what you want (i.e. nothing if you don’t require particular stuff…) and then get to Exit (and select Yes if you changed something, if you didn’t you won’t be prompted).

It is time to actually compile the kernel.

ARCH=arm CROSS_COMPILE=arm-eabi- make

The first time this will be a long procedure, the resulting file will be stored in

arch/arm/boot/zImage

and you can test it on your device directly by going into fastboot mode (hold the BACK button while powering up the device). Then issue this command:

fastboot boot arch/arm/boot/zImage

The phone should boot up normally and you can confirm that it’s running your kernel by going into Settings-About-Scroll down to the Kernel section. Note that if you reboot the phone it will go back to using the pre-installed kernel. More on flashing the kernel later on.

NexusOne with standard Android OS

First we need to unlock the NexusOne to accept new roms to be installed, have it in fastboot mode by holding the TRACKBALL down while booting up and issue this command

fastboot oem unlock

Note that this will void your warranty!

We also need the NexusOne to be rooted: rooting goes beyond the scope of this tutorial. Have your phone rooted in any way that you want (i.e. by using the SuperOneClick tool (it requires a Windows machine or luck with a Linux one).

This one is much more interesting! And while being very similar it also has some differences. First of all from our ~/android/ directory let’s move to the google-kernel directory and again create our own branch to work on.

cd ~/android/google-kernel
git checkout -b personal_branch origin/android-msm-2.6.32

Note that in this case we’re using the kernel version 2.6.32 which is the one that’s installed by default on the NexusOne. The latest 2.6.35 should work but I haven’t really tested.

Next we create the usual .config file

ARCH=arm CROSS_COMPILE=arm-eabi- make mahimahi_defconfig
ARCH=arm CROSS_COMPILE=arm-eabi- make menuconfig

Hit Exit and save if prompted (you shouldn’t!)

We now manually modify the .config file with your favorite text editor open the file and search for these strings

nano .config
uncomment CONFIG_USB_ANDROID_ACM=y (add the =y part and remove what's there)
comment CONFIG_MSM_SERIAL_DEBUGGER
comment CONFIG_MSM_FIQ_SUPPORT

We’re ready to compile the kernel

ARCH=arm CROSS_COMPILE=arm-eabi- make

This will take some time, the resulting product will be stored in arch/arm/boot/zImage and you can test it on your device directly by going into fastboot mode (hold the TRACKBALL down while powering up the device). Then issue this command:

fastboot boot arch/arm/boot/zImage

The phone should boot up normally and you can confirm that it’s running your kernel by going into Settings-About-Scroll down to the Kernel section. Note that if you reboot the phone it will go back to using the pre-installed kernel. More on flashing the kernel later on.

NexusOne enable my WiFi, please

The WiFi kernel module that is on the NexusOne is not compiled to work with this kernel that we are using therefore WiFi won’t work. There’s a work around but it requires you to have root privileges on your device. Rooting goes beyond the scope of this tutorial. Have your phone rooted in any way that you want (i.e. by using the SuperOneClick tool (it requires a Windows machine or luck with a Linux one).

First you copy the compiled kernel module to the phone /sdcard

cd ~/android/google-kernel
adb push drivers/net/wireless/bcm4329/bcm4329.ko /sdcard/

Then you need to make the phone /system partition writable, back up the old module and install the new one

adb shell
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cd /system/lib/modules/
cat ./bcm4329.ko > ./bcm4329.ko-orig
cat /sdcard/bcm4329.ko > ./bcm4329.ko
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system

At this point your WiFi should be working again! :)

On flashing for awesome later use

Now that you tested that your compiled/(modified) kernel is actually working you may want to have it installed also after rebooting the phone. To achieve this you need to flash it to the phone internal storage. It is advisable that first you backup everything using a recovery tool (Amon RA 2.0.0 for the NexusOne works great with the nandbackup tool).

First grab two utilities that will be needed for this step and unzip them into the ~/android/bootimg_builder directory that we have created previously.

Throughout this part of the tutorial I will give commands for both the Magic and the NexusOne, please use only the ones that are useful for your case.

We first need to grab the boot.img file from the running device, have the device running and connected to the PC via USB then issue the command

cd ~/android/bootimg_builder
adb shell
cat /dev/mtd/mtd2 > /sdcard/mtd2.img
exit
adb pull /sdcard/mtd2.img ./nexus-boot.img

OR for the MAGIC

adb pull /sdcard/mtd2.img ./magic-boot.img

We now extract the boot.img-kernel and ramdisk by using the supplied perl script

./split_bootimg.pl nexus-boot.img

OR for the MAGIC

./split_bootimg.pl magic-boot.img

The output of this command will be along the lines of:

Page size: 2048 (0x00000800)
Kernel size: 2226104 (0x0021f7b8)
Ramdisk size: 164628 (0x00028314)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend=1 msmsdcc_sdioirq=1 wire.search_count=5
Writing nexus-boot.img-kernel ... complete.
Writing nexus-boot.img-ramdisk.gz ... complete.

We now need to copy the compiled kernel to our working directory discarding the one extracted previously

cd ~/android/bootimg_builder
cp ../google-kernel/arch/arm/boot/zImage ./nexus-boot.img-kernel
OR for the MAGIC
cp ../cm-kernel/arch/arm/boot/zImage ./magic-boot.img-kernel

Now we combine everything into just one boot.img that we can then flash to the device

./mkbootimg --kernel nexus-boot.img-kernel --ramdisk nexus-boot.img-ramdisk.gz -o boot.img --cmdline 'no_console_suspend=1 msmsdcc_sdioirq=1 wire.search_count=5' --base 0x20000000

OR for the MAGIC

./mkbootimg --kernel magic-boot.img-kernel --ramdisk magic-boot.img-ramdisk.gz -o boot.img --cmdline 'no_console_suspend=1 console=null'

At this point we’re ready to flash the new image to the device, have it in fastboot mode (TRACKBALL on the NexusOne, BACK on the Magick while booting up) and issue the command

fastboot flash boot boot.img
fastboot reboot

If everything has gone well enjoy your new kernel installed definitively on your device. You did make a nandbackup before in case you want to go back, right? Well, I told you to :D

Conclusion and Acknowledgments

Hope you enjoyed this full tutorial on everything needed to compile, test and install a kernel on a NexusOne or on a Magic with CyanogenMod installed. I would like to thank you all that have done the hard work of writing tutorials on how to do so before [here|here], the guys that maintain CyanogenMod [here|here] and those who wrote the perl script to extract the two images from the boot.img file [here]. Mine has been just a work of aggregation. But I wanted to have everything working and described in a single post.

Cheers.

~C

Logitech Wave Pro – MacOSX

Hi all,
short post, but hopefully helpful to some!

I recently bought a new keyboard + mouse set from logitech. I tendo to get quite bad with the wrists, especially when typing much. Long story short, I have been using a Logitech Wave keyboard for a long time! Now, since I will be spending much time at the office (and not only at home) I thought I could buy a new set for office/home. I just went to the Logitech website and set for a wonderful Logitech Wave Pro. Now, if only I had checked the fact that they say that it’s not compatible with MacOS X!

But well, the set arrived, I plugged it in, and to my horror it wasn’t recognized in the System Preferences Logitech Control Center (latest version, 3.3.0). The message was simply: “No Logitech Device Found”…

My “hacker” spirit of course couldn’t bear with this fact. Especially because the keyboard looked exactly like the Wave (not the Pro, mind it)… The mouse itself is simply an MX1100, which is supported by default… Weird, weird.

I started digging and found out the the (in)famous Logitech Software installs some special files in the usual paths:

/Library/Application Support/Logitech.localized/Logitech Control Center.localized/LCCDaemon.app/Contents/Resources

In particular files named:

Hardware Descriptions 2002.plist
Hardware Descriptions 2006.plist
Hardware Descriptions 2007.plist
Hardware Descriptions 2008.plist
Hardware Descriptions 2009.plist
Hardware Descriptions 2010.plist

Now, if one is to open such files with the standard application (Property List Editor) he will find something along the lines of:

Bingo! Now I only had to find out the actual HEX number/product ID. How? Easy, I switched to a windows installation, installed the Logitech SetPoint software, dumped a text file generated by the bug/hardware/problems reporter and voila, found my numbers:

0.000 Device 0x009018d8 parent=0xffffffff model=0x0300001e bus=2-USB       type=3-RECEIVER  ser=	 vid=046D pid=C517 rev=3810 name=Loreley 2RX
0.000 Device 0x008010b0 parent=0x009018d8 model=0x01000087 bus=2-USB       type=1-MOUSE     ser= vid=0000 pid=003C rev=0000 name=LX8 Cordless Laser Mouse (Gomera Dkt)
0.000 Device 0x00a02100 parent=0xffffffff model=0x0300001e bus=2-USB       type=3-RECEIVER  ser=	 vid=046D pid=C517 rev=3810 name=Loreley 2RX
0.000 Device 0x00700888 parent=0x00a02100 model=0x0200005b bus=2-USB       type=2-KEYBOARD  ser= vid=0000 pid=0060 rev=0000 name=Wave Cordless Keyboard
0.000 Device 0x00d03978 parent=0xffffffff model=0x03000030 bus=2-USB       type=3-RECEIVER  ser=	 vid=046D pid=C529 rev=0700 name=eQuad desktop receiver (Kiwi DT Mercury)
0.000 Device 0x00b02928 parent=0x00d03978 model=0x02000063 bus=2-USB       type=2-KEYBOARD  ser=QADR:38CC4662 vid=0000 pid=2003 rev=0000 name=MKT name TBD (Mercury)
0.000 Device 0x00c03150 parent=0x00d03978 model=0x0100008e bus=2-USB       type=1-MOUSE     ser=QADR:38CC4662 vid=0000 pid=1015 rev=0000 name=MX Pro (Macau RC)

I just copied the MX1100 entry in the 2008.plist file and modified the pID (actually just one number increase!) and the one for the wave keyboard. Restarted the Logitech Demo and everything is fully working (well, almost, some keys on the keyboard are apparently mapped in a different way, but I never use them too much, it _might_ be fixable, if I have some more time…).

Anyway, for those who didn’t understand too much, here’s a .zip with the new file, you can just unzip it and place it in your directory, restart the Logitech Daemon (or reboot the PC) and your Wave Pro Set will now be supported!

  1. Download the .zip
  2. Uncompress its content
  3. in the Finder go to: /Library/Application Support/Logitech.localized/Logitech Control Center.localized/
  4. Right-click on the LCCDaemon.app and Show Package Contents
  5. go into Contents/Resources/
  6. (optional) backup the file called: Hardware Descriptions 2008.plist
  7. Copy the uncompressed file
  8. Reboot (or restart the Logitech Daemon from the Activity Monitor/Terminal)

As a result, you will get this beauty in your Logitech System Preferences

Hope it helps!

~Claudio

Update(s)

I haven’t been writing in a long (loooooooooong) time, plus I haven’t been writing a lot on general topics rather than technical ones.

I have finished my master at ETH Zürich with the maximum grade on my master thesis. AND I started my PhD there, with focus on system and network security.

I’m currently at Fosad, a summer school on security design held in Bertinoro, Italy

For all of you that come here for some ImageMagick update, please make sure to check out the latest compiled version on their ftp site (or any mirror, under the iPhone directory!). I always try to keep up with the compilation, but most of the times I will be a little late with their release.

For all of you that come here for some uMonitor update, please wait. I have some updates in mind, and some fixes. But uMonitor is totally not my first priority and probably won’t be ever again. It is open-sourced so that anyone can contribute. I’ve pushed an update on Cydia, lately, to fix some issues. Plus in the future I will have some icons updates for all the iPhone4 users around.

Stay tuned for any updates, as usual!

~C

iTunes Store – Price increase…

… Or am I dreaming? (or well, having a nightmare!?)


[if you click on it you actually see something!]

Ok. Last time I checked the iTunes store, in Switzerland (where I currently live, and a friend of mine has a Swiss iTunes Store account) the most expensive songs (the “hits”?) were rated at 2.- chf – In Italy (where I have my iTunes Store account) most expensive songs were rated at 1.29 euro.

Now, the Swiss Store has always been more expensive (1.29 euro ~= 1.70 chf) – but now!? Are you joking!? 2.20 chf, as shown in the pictures, it’s 1.66 euro, or, for the US guys it’s 2.03 usd!!!

I find this price increase outrageous. We (everyone that’s not living in the US) have always been paying more for our songs (0.99 euro [1.21 usd] and 1.50 chf [1.39 usd]). But now it’s even worse.

It just doesn’t make sense, anymore, so what? I just feel robbed. And robbed. Over again. 10% price increase What’s next?

Bye bye.

~C

Reader Notifier Reloaded

Hi,
I’m using Google Reader, as an aggregator for all the feeds that I want to follow. Great! So I don’t have to keep those 6 tabs open in my favorite browser, right? Well, kind of. The problem resides in the fact that then I would still have my mail and calendar open. And google reader. And …

Mike and me have been looking around for a solution to this and stumbled across Reader Notifier. It’s a small MacOSX application that resides in the Menu bar and notifies you when new items are available.

Since the code was publicly available we decided to have a look at it… Well, after coding for a while for iPhone and Mac applications we could tell immediately that we could have improved the code and possibly the application functionalities. Now Reader Notifier Reloaded is born. We keep the code open, so that everyone can just fork it, modify it, have a look at it, …

Currently Reader Notifier Reloaded lets you:

  • Be notified through Growl about new unread items
  • Mark all your feeds as read
  • Read the feed directly through the menu application
  • Star an item
  • Automatic updates

And all of this with a much more structured code than the original and without any memory leaks (well, there were many and we managed to remove them all, hopefully).

A stable version is downloadable from github

If you have feature requests, find bugs or just want to get involved with the project, drop us a note either here or on github.

-Mike and Claudio

Sparkle script in XCode

So,
for a project that I’m working on (Reader Notifier Reloaded, more about it in a following post), I’ve been using Sparkle. It is a great tool for providing updates to the users.

Since Sparkle is using public/private key cryptography in order to sign the updates and guarantee their authenticity there is some “fiddling” one has to do in order to push out an update. Marc Liyanage provides us with a great way to do all the signing, packaging and xml generation for updates.

I’ve been using his technique and just adapted the shell script to make it work on my Snow Leopard 10.6.3 without the need of the libxml perl library.

In particular I’ve changed the SIGNATURE part to:

SIGNATURE=$(
	myvar=$(security find-generic-password -g -s "Sparkle Private Key" 2>&1 1>/dev/null | sed 's/.*-----BEGIN DSA PRIVATE KEY-----\\012\(.*\)\\012-----END DSA PRIVATE KEY-----.*/-----BEGIN DSA PRIVATE KEY-----\
\1\
-----END DSA PRIVATE KEY-----/g' | sed 's/\\012/\
/g')

echo "$myvar" > tmp.tmp

openssl dgst -sha1 -binary < "$ARCHIVE_FILENAME" \
| openssl dgst -dss1 -sign tmp.tmp \
| openssl enc -base64

rm tmp.tmp
)

So, here’s the script I’m using, if anyone wants it!

set -o errexit

if [[ $BUILD_STYLE != "Deploy" ]]; then 
	echo Distribution target requires "'Deploy'" build style
	exit
fi

VERSION=$(defaults read "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Contents/Info" CFBundleVersion)
DOWNLOAD_BASE_URL="http://www.example.com/some_product"
RELEASENOTES_URL="http://www.example.com/some_product/$VERSION.html"

ARCHIVE_FILENAME="${PRODUCT_NAME}_$VERSION.zip"
DOWNLOAD_URL="$DOWNLOAD_BASE_URL/$ARCHIVE_FILENAME"
KEYCHAIN_PRIVKEY_NAME="Sparkle Private Key"

WD=$PWD
cd "$BUILT_PRODUCTS_DIR"
rm -f "$PRODUCT_NAME"*.zip
ditto -ck --keepParent "$PRODUCT_NAME.app" "$ARCHIVE_FILENAME"

SIZE=$(stat -f %z "$ARCHIVE_FILENAME")
PUBDATE=$(LC_TIME=en_US date +"%a, %d %b %G %T %z")
SIGNATURE=$(
	myvar=$(security find-generic-password -g -s "Sparkle Private Key" 2>&1 1>/dev/null | sed 's/.*-----BEGIN DSA PRIVATE KEY-----\\012\(.*\)\\012-----END DSA PRIVATE KEY-----.*/-----BEGIN DSA PRIVATE KEY-----\
\1\
-----END DSA PRIVATE KEY-----/g' | sed 's/\\012/\
/g')

echo "$myvar" > tmp.tmp

openssl dgst -sha1 -binary < "$ARCHIVE_FILENAME" \
| openssl dgst -dss1 -sign tmp.tmp \
| openssl enc -base64

rm tmp.tmp
)

[ $SIGNATURE ] || { echo Unable to load signing private key with name "'$KEYCHAIN_PRIVKEY_NAME'" from keychain; false; }

cat > $VERSION.xml <<EOF
<item>
	<title>Version $VERSION</title>
	<sparkle:releaseNotesLink>$RELEASENOTES_URL</sparkle:releaseNotesLink>
	<pubDate>$PUBDATE</pubDate>
	<enclosure
		url="$DOWNLOAD_URL"
		sparkle:version="$VERSION"
		type="application/octet-stream"
		length="$SIZE"
		sparkle:dsaSignature="$SIGNATURE"
	/>
</item>
EOF

iPhoneManagers

Mike and I are glad to announce to all you iPhone developers a library that we’ve been building together that enables very fast and easy development of network-related iPhone applications.

In particular in the library you will find:

  • Network Manager – easy way to deal with parallel asynchronous network requests
  • Image Manager – easy way to download and cache images on the iPhone
  • SystemMessage Manager – unified way to display HUD messages across the application, both auto-disappearing or not

If you are interested you can grab the source and compile it for your project, it will create a standard static library that you can include in your projects. Header files have relevant comments that will make your life easier when dealing with the library.

For any feedback don’t hesitate to write over here or at the github page.

Enough talking, just try it out! And here’s two images of the SystemMessageManager displaying its HUD windows:


Latest ImageMagick

UPDATE: iOS4.3 and Xcode4

Hi,
I’ve compiled the latest ImageMagick for iPhone with the usual png/tiff/jpeg compatibility. Everything is compiled so that it shouldn’t be rejected by Apple. Please let me know if that’s the case.

You can find the latest 6.6.1-5 version here:IM 6.6.1-5
Or if you dare the latest beta 6.6.1-6 here:IM 6.6.1-6

As usual you can find the latest updated working XCode project here:IM_Test project

I’m in talks with the developers of ImageMagick to try and have a “standard” build for iPhone so that everyone can just go there. I will keep you up to date with it.

Please report any issues you might have and especially if now the applications will be accepted by Apple!

Regards,

~C

Starcraft 2 on Mac

Update:

In Europe as well! :)

Ok, the long awaited beta for Mac should be on its way.
The (infamously inactive) link has become active. It still yields to a “forbidden” page, but that’s soon to be changed. All Mac testers, free your hard-drives, for Starcraft 2 is definitely coming!

Here it shows that the link is clickable:

And here’s the content of the linked page:

ABOUT

CLOUD GOES SOCIAL is the personal blog of Claudio Marforio.
He holds a MSc in Computer Science with focus on Information Security granted by ETH Zurich. He is currently a PhD Student in the System Security Group of ETH Zurich

Categories

Donate

If you appreciate my work, my applications, this blog in general or you simply feel like rewarding me for something please consider donate.
Any amount will motivate me in keeping up with the blog and the applications.


Thank you!

Donors

F. Olsen, W. Chang, W. Edmondson, C. Sharff, M. Brown, G. Helton, J. de Ruiter, K. Langner, K. Smith, T. OHalloran, B. Zabarauskas

Listening to ...