This page describes how to build proper udebs. Since I have only done this once, and I haven't even tested the result, there may be many errors here. Please correct them!
You need to define that you're building the udeb using debian/control. It looks very much like any other binary package. Special things are:
- The Section: must be overridden to be debian-installer. I guess it is fine to define that for the source (and therefore all binaries), but usually you're building a normal deb as well, which will need a different section.
- There needs to be an extra line, saying: "XC-Package-Type: udeb".
If the udeb needs to be listed in the installer's main menu, you will also need to set a correct default menu position using "XB-Installer-Menu-Item: <position>".
- It is likely that packages which are normally Priority: optional are now Priority: extra.
The rest is the same as a normal package. Except that for udebs, you will probably want to strip a lot of stuff (documentation, themes, that sort of things). Udebs don't have to follow policy in many respects, but it is important that they are small. Most of this is taken care of automatically by debhelper if you have set XC-Package-Type correctly.