move kernel-packing code