Which script of the android build tree is giving the "suid" flag to the su binary before the system.img file is packed? I've "grepped" for "chmod +s" or "chmod 4" strings but no luck for now.
Found the solution. The file I was searching for is :
system/core/include/private/android_filesystem_config.h
Suid binaries are defined in the "android_files" structure. For the su binary there is this entry:
{ 06755, AID_ROOT, AID_ROOT, "system/xbin/su" },