Jump to content
XPEnology Community

[HowTo] Modify boot image


Recommended Posts



this is just a short tutorial how you could modify the boot image, e.g. to include your own kernel. I did not find any tutorial for this use case in the wiki.


1. First you need an existing image file. E.g. synoboot-trantor-dsm4.2-v1.0.img.

2. Do the following as root.

2. Map it to a loop device:

$ losetup -f synoboot-trantor-dsm4.2-v1.0.img 
$ kpartx -a -v synoboot-trantor-dsm4.2-v1.0.img 
add map loop1p1 (253:4): 0 32067 linear /dev/loop1 63

3. Mount the partition:

$ mount /dev/mapper/loop1p1 /mnt

4. Modify it. E.g. copy new kernel to /mnt.

5. Umount it:

umount /mnt

6. Remove mapping:

$ kpartx -d synoboot-trantor-dsm4.2-v1.0.img 
loop deleted : /dev/loop1
$ losetup -D


Here you go.

This is also a memo for myself.

Link to comment
Share on other sites

  • Create New...