Wednesday, 30 May 2012

New OpenELEC RasPi build up - R11170

I've built the latest version available from the OpenELEC Git repo - unfortunately I can't easily see from their readme file what the changes are but looking through the open issues - it's most likely bug fixes. I haven't created an SD image yet - but it'll be up later today in a new and improved smaller image size for people with smaller cards. I'll add some instructions for how to resize the storage partition if you have a larger card too.

R11170 Bootloaders (only if you're creating manually)
R11170 System and Kernel binaries

1GB SD image (I haven't been able to test this yet so let me know if it works for you.)
I've made the SD image with the smallest card I had available because lots of people commented that 8GB was too large. The image should write to cards 1GB+, but you'll need to resize your Storage partition if you want to take advantage of any extra space on your card.

Friday, 25 May 2012

Raspberry Pi - Formatting an SD card for OpenELEC

Turns out the SD card I was using for my OpenELEC image is slightly larger then everyone elses - meaning the image won't write back correctly using Win32 imager / dd.
There is a good start to finish guide here, but for clarity and simplicity - I'll outline them here too.

First identify where your Linux OS has attached your SD card (mine was the same as this guide, /dev/sdb). Typing dmesg and examining the output will most often be the easiest way to find this. For these instructions, we'll assume yours is also attached to /dev/sdb


We need to ensure the device is not mounted anywhere first (Ubuntu, for example, will automatically try to mount removable media in /media/[device-name]


sudo umount /dev/sdb

Next, remove all existing partitions (and also, data - make sure this card is not important, backed up etc.)

sudo parted -s /dev/sdb mklabel msdos

Data removed, we'll need to create two partitions. The first being FAT32 which will become the system / boot partition for OpenELEC. The second, an EXT file system for OpenELEC using all remaining space on the card.

sudo parted -s /dev/sdb unit cyl mkpart primary fat32 -- 0 16
sudo parted -s /dev/sdb set 1 boot on
sudo parted -s /dev/sdb unit cyl mkpart primary ext2 -- 16 -2

This should give you your two required partitions. Next, you will need to format these new partitions.

sudo mkfs.vfat -n System /dev/sdb1
sudo mkfs.ext4 -L Storage /dev/sdb2

At this point, it's best to pop the card out and reinsert it to have the OS recognise the new partitions and if you're lucky - mount them for you. Otherwise, you'll need to create some mount points and reload the cards partitions manually.

sudo partprobe
sudo mkdir /mnt/System
sudo mkdir /mnt/Storage

sudo mount /dev/sdb1 /mnt/System

Now, it's as simple as copying the files from my zipfile into the right places. Extract everything to an easy to access directory, we'll use /tmp. Copy the files across (note - some of them need to be renamed which is taken care of in the code below). Then make sure you're not in a mounted directory and unmount the SD card. Fingers crossed, it should be ready for use!

sudo cp /tmp/OpenELEC-RPi.arm-devel-20120514154309-r10954.kernel /mnt/System/kernel.img
sudo cp /tmp/OpenELEC-RPi.arm-devel-20120514154309-r10954.system /mnt/System/SYSTEM

sudo cp /tmp/bootcode.bin /mnt/System/
sudo cp /tmp/loader.bin /mnt/System/
sudo cp /tmp/arm128_start.elf /mnt/System/start.elf
cd /
sudo umount /dev/sdb

Tuesday, 15 May 2012

Raspberry Pi - OpenELEC / XBMC

After several hours of compiling - I've got a working OpenELEC (XBMC) image for Raspberry Pi! I've given it a quick test and most things seem to work ok. I followed the build instructions from the OpenELEC site and the builds from the past couple of days seemed to fail for various reasons but yesterday mornings (10954) seemed to build perfectly! For anyone not wanting to bother with compiling and formatting their SD card - I've put this into an image you can write to your SD card with dd or win32imager.

(Update - 21/05/2012) - A few people have commented that the image is too large for some 8Gb SD cards. The card I used to create the image shows up as 16152576 512byte sectors so if your card is smaller than this, you might be out of luck. In this case, use the Binary only download and follow the 'preparing and formatting' instructions below.

OpenELEC for Raspberry Pi - Build 10954 (8GB Image)

Edit: I've added the binaries too for anyone using an SD card which is smaller than 8Gb. If you want to use these, you'll need to prepare your SD card according to the this page, but using the files from the zip instead of the target directory.

OpenELEC for Raspberry Pi - Binaries only

Monday, 14 May 2012

CP hitcount - A Python rule-hit counter for Check Point

This is something I was working on a while ago. I needed a way to chew through a large amount of Check Point logs and find out which rules were being hit in the rulebase according to the UUID of the rule and the UUID in the log entry. This has now been implemented to some degree in R75.40 with the hit counter in the dashboard but this might still be useful for anyone that wants to make some pretty graphs out of it.
It requires you to export your logs into text format, either with Smartview Tracker (which seems to take forever) or with 'fwm logexport' (there's a script included if you want to modify it). All code is provided as is, drop me a comment if you find any use for it!

I don't have any formal instructions but the comments should be enough to get you though. It's all Python 2.6 but should work in 2.7. Not tested in 3.x. When you've got the code downloaded, run analyse.py and point the script to your rulebases_5.0.fws and text log file. It will churn through the log file and should spit out an HTML file showing which logs are hit, how many times and which are never hit. It's not perfect, but it's a good starting point for clearing out a rulebase.


Analyse.py : Run this and follow prompts

fwlog2txt.sh : This will dump logs in a particular range to a big text file to use with the tool. To be run on your gateway / Smartcenter

logFunc.py : The modules and routines called by analyse.py

style.css : Not essential, but makes the html output a little prettier

Sample output from the CP hitcount tool