cpio.mk 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ################################################################################
  2. #
  3. # cpio to archive target filesystem
  4. #
  5. ################################################################################
  6. ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
  7. define ROOTFS_CPIO_ADD_INIT
  8. if [ ! -e $(TARGET_DIR)/init ]; then \
  9. ln -sf sbin/init $(TARGET_DIR)/init; \
  10. fi
  11. endef
  12. else
  13. # devtmpfs does not get automounted when initramfs is used.
  14. # Add a pre-init script to mount it before running init
  15. # We must have /dev/console very early, even before /init runs,
  16. # for stdin/stdout/stderr
  17. define ROOTFS_CPIO_ADD_INIT
  18. if [ ! -e $(TARGET_DIR)/init ]; then \
  19. $(INSTALL) -m 0755 fs/cpio/init $(TARGET_DIR)/init; \
  20. fi
  21. mkdir -p $(TARGET_DIR)/dev
  22. mknod -m 0622 $(TARGET_DIR)/dev/console c 5 1
  23. endef
  24. endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
  25. ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
  26. define ROOTFS_CPIO_CMD
  27. cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
  28. endef
  29. ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
  30. ROOTFS_CPIO_DEPENDENCIES += host-uboot-tools
  31. define ROOTFS_CPIO_UBOOT_MKIMAGE
  32. $(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \
  33. -C none -d $@$(ROOTFS_CPIO_COMPRESS_EXT) $@.uboot
  34. endef
  35. ROOTFS_CPIO_POST_GEN_HOOKS += ROOTFS_CPIO_UBOOT_MKIMAGE
  36. endif
  37. $(eval $(rootfs))