Arduino Due 16u2 Bootloader

I need to write a custom bootloader for the Due running on the 16u2.
The source that comes with Arduino IDE (SAM DUE BOARD) is not working with bossac.
Is there an official SAM-BA bootloader source code out there that works with bossac, like the official bootloader? If so where can I find it?

iKjetil

The source that comes with Arduino IDE (SAM DUE BOARD) is not working with bossac.

Which source, exactly, are you looking at?
All the instructions I find for upgrading the 16u2 says it uses DFU/FLIP, not bossac.
And apparently the current due uses a 32u2?

Are you sure you're trying to update the 16u2 bootloader? It's not usually involved in much of anything.
The SAM3X bootloader is in ROM and can't be updated.