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!
debian/control
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".
- It is likely that packages which are normally Priority: optional are now Priority: extra.
the rest
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.