+# Enable loader and prepare kernel
+ifeq ($(strip $(BR2_PACKAGE_LOADER)),y)
+export LINUX_LOADER=$(BUILD_DIR)/lzmaldr
+export LINUX_IMAGE=$(BUILD_DIR)/piggy.lzma
+else
+export LINUX_IMAGE=$(BUILD_DIR)/piggy.gz
+endif
+
+$(BUILD_DIR)/piggy.lzma: $(LINUX_KERNEL)
+ cat $^ | $(BUILD_DIR)/lzma/lzma e -si -so -eos > $@ || (rm -f $@ && false)
+
+$(BUILD_DIR)/piggy.gz: $(LINUX_KERNEL)
+ cat $^ | gzip -c9 $^ > $@ || (rm -f $@ && false)
+