How to make a KiSS bootable ISO firmware with mkisofs under linux ?

O/ Why ?

The reason why I wrote this is that I am on the (long) way to port Freevo on my KiSS PVR.
I'm doing this because I'm really unsatisfied by the software provided by KiSS technology which is totally bugged.
Because this is a closed software (You don't have acces to all the sources) it is impossible to fix these bugs.
I will try to add material here each time I will succeed in a step to my project.
Help would be greatly appreciated, you can contact me here kiss_AT_molteni_DOT_net

1/ Get a boot image

First, you need to obtain an image of the boot loader from an original KiSS firmware.
Original firmware can be downloaded from the KiSS Technology web site.
You should get a ZIP file containing the original ISO image of the firmware.

We will extract the boot loader from this ISO.
There are two way of doing this :

First methode : isoinfo + dd

run isoinfo to print information from the primary volume descriptor

% isoinfo -d -i DP-1500-293-050604-1435.iso

CD-ROM is in ISO 9660 format
System id: LINUX
Volume id: KiSS DP-xxx
Volume set id:
Publisher id: KiSS Technology A/S
Data preparer id:
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048                                                    <====  (1)  Block size on the ISO
Volume size is: 2485
El Torito VD version 1 found, boot catalog is in sector 2365
NO Joliet present
NO Rock Ridge present
Eltorito validation header:
        Hid 1
        Arch 3 (Unknown Arch)
        ID 'KiSS Technology A/S    '
        Key 55 AA
        Eltorito defaultboot header:
        Bootid 88 (bootable)
        Boot media 0 (No Emulation Boot)
        Load segment 0
        Sys type 0
        Nsect 237                                                               <==== (2) 0x237=567 blocks (boot loader size in bloks)
        Bootoff 706 1798                                                    <==== 0x706=1798 blocks offset (first boot loader block on the ISO)

Now You know that you just have to extract 567 blocks of 2048 bytes starting at 1798 blocks of 2048 byte from the ISO beginning.
Copy it in your source tree :

% dd if=DP-1500-293-050604-1435.iso of=My-firmware-direcory/boot-loader/boot.image_0 bs=2048 count=567 skip=1798

Second way : cdfs

First install cdfs on your system (Here you can find information and sources).
Next, mount the original KiSS ISO on a directory using cdfs :

# mount -t cdfs /dec/cdrom /mnt

Now, you can simply copy the boot image to your source tree :

% cp /mnt/boot.image_0 My-firmware-direcory//boot-loader

2/ Patch mkisofs

To successfully make a KiSS ISO you will have to explain to mkisofs how to set the Arch type to 3 as you could have notice when using isoinfo.
You must explain it too how deal with the virtual sector size for the El Torito boot record.
Fortunately, Albert SEWARD and Erik THYREN provided a Patch for mkisofs on their KiSS page where they did a very good reverse engineering job !!
I have just added the use of a command line option (-kiss) to activate this only when needed in this patch file.

Ok, let's download the mkisofs sources wich is in fact a part of cdrtools.
Alternatively, if you are a Debian user, you should use apt-get sources mkisofs.

Next, cd to the mkisofs source directory and apply the patch :
% patch -p1 < KiSS-mkisofs.diff

Then, make and install the new mkisofs version by using instructions found in the INSTALL file at the root of the cdrtools.
Again, Debian users should dpkg-buildpackage and dpkg -i mkisofs__something.deb.

3/ Using the good mkisofs options

Here we are !
I spent many days to read output from isoinfo, isodump and even hexdump of KiSS ISOs to understand why my own ISOs was not booting. But eventualy, I succed to write the magic command line that do the job !

First you have to put in a directory all the material you want tu put on the CD (Kiss original files plus your modified romfs.bin).
Don't forget to create the boot-loader directory and copy the boot-loader in it !

Next change directory to this one and  create the bootble ISO :

%mkisofs -no-pad -allow-lowercase -iso-level 4 \
                -b boot-loader/boot.image_0 -c boot-loader/  -hide boot* \
                -kiss -no-emul-boot -V "KiSS DP-xxx" -publisher 'KiSS Technology A/S    ' \
                -o ../myiso.iso .

Be sure to not forget the 5 leadinf spaces at the end of the publisher string :-)

That's all falks !
You just have to burn a CD using cdrecord (rewritable works perfectly) and try a run ...