Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(TOPDIR)/rules.mk
  4. include $(TOPDIR)/mk/kernel.mk
  5. include $(TOPDIR)/mk/modules.mk
  6. include $(TOPDIR)/mk/kernel-build.mk
  7. include $(TOPDIR)/mk/image.mk
  8. KERNEL:=$(LINUX_DIR)/arch/x86/boot/bzImage
  9. $(TOOLS_BUILD_DIR):
  10. @mkdir -p $(TOOLS_BUILD_DIR)
  11. tools-compile: $(TOOLS_BUILD_DIR)
  12. $(MAKE) -C ../tools/grub prepare compile install
  13. createinitcrypt:
  14. $(SED) 's#^CONFIG_INITRAMFS_SOURCE.*#CONFIG_INITRAMFS_SOURCE="./initramfs_list"#' $(LINUX_DIR)/.config
  15. echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config
  16. echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config
  17. echo N |$(MAKE) -C $(LINUX_DIR) V=1 CROSS_COMPILE="$(TARGET_CROSS)" ARCH=$(ARCH) \
  18. CC="$(TARGET_CC)" oldconfig $(MAKE_TRACE)
  19. $(MAKE) -C $(LINUX_DIR) V=1 CROSS_COMPILE="$(TARGET_CROSS)" ARCH=$(ARCH) \
  20. CC="$(TARGET_CC)" $(MAKE_TRACE)
  21. @cp $(KERNEL) $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel
  22. ifeq ($(FS),archive)
  23. imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL)
  24. @cp $(KERNEL) ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel
  25. @echo 'The kernel file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel'
  26. @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL)"
  27. ifeq ($(ADK_HARDWARE_QEMU_X86),y)
  28. @echo "Use following command to create a QEMU Image:"
  29. @echo "sudo ./scripts/create-image.sh -f ${ADK_TARGET_ROOTFS} qemu-${CPU_ARCH}.img $(BIN_DIR)/$(ROOTFSTARBALL)"
  30. @echo "Start qemu with following command line:"
  31. @echo 'qemu -nographic -net user,hostfwd=tcp::2222-:22 -net nic,model=e1000 -kernel $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel qemu-${CPU_ARCH}.img'
  32. endif
  33. endif
  34. ifeq ($(FS),usb)
  35. imageinstall: tools-compile $(BIN_DIR)/$(ROOTFSTARBALL)
  36. @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL)"
  37. @echo "To install everything to USB use scripts/install.sh"
  38. endif
  39. ifeq ($(FS),initramfs)
  40. imageinstall: $(BIN_DIR)/$(INITRAMFS)
  41. @cp $(KERNEL) $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel
  42. @echo 'The kernel file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel'
  43. @echo 'The initramfs image is: ${BIN_DIR}/${INITRAMFS}'
  44. ifeq ($(ADK_HARDWARE_QEMU_X86),y)
  45. @echo "Start qemu with following command line:"
  46. @echo 'qemu -nographic -net user,hostfwd=tcp::2222-:22 -net nic,model=e1000 -kernel $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel -initrd ${BIN_DIR}/${INITRAMFS}'
  47. endif
  48. endif
  49. ifeq ($(FS),initramfs-piggyback)
  50. imageinstall: ${BUILD_DIR}/${INITRAMFS_PIGGYBACK} createinitramfs
  51. @cp $(KERNEL) ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel
  52. @echo 'The kernel+initramfs file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel'
  53. ifeq ($(ADK_HARDWARE_QEMU_X86),y)
  54. @echo "Start qemu with following command line:"
  55. @echo 'qemu -nographic -net user,hostfwd=tcp::2222-:22 -net nic,model=e1000 -kernel $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel'
  56. endif
  57. endif
  58. ifeq ($(FS),encrypted)
  59. imageinstall: $(BIN_DIR)/$(ROOTFSUSERTARBALL) createinitcrypt
  60. @echo 'The kernel+cryptinit file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel'
  61. @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSUSERTARBALL)"
  62. @echo 'Boot your IBM X40 via NFS or USB.'
  63. @echo 'Then create at least three partitions with fdisk:'
  64. @echo '/dev/sda1 (ext2)'
  65. @echo '/dev/sda2 (encrypted root)'
  66. @echo '/dev/sda3 (swap)'
  67. @echo 'mkdir /mnt/{boot,root}'
  68. @echo 'mke2fs /dev/sda1'
  69. @echo 'cryptsetup luksFormat /dev/sda2'
  70. @echo 'cryptsetup luksFormat /dev/sda3'
  71. @echo 'cryptsetup luksOpen /dev/sda2 root'
  72. @echo 'cryptsetup luksOpen /dev/sda3 swap'
  73. @echo 'mkfs.xfs /dev/mapper/root'
  74. @echo 'mkswap /dev/mapper/swap'
  75. @echo 'mount /dev/sda1 /mnt/boot'
  76. @echo 'mount /dev/mapper/crypt /mnt/root'
  77. @echo 'mkdir /mnt/boot/boot'
  78. @echo 'Copy $(ROOTFSUSERTARBALL) via scp to /mnt/root and extract it'
  79. @echo 'cd /mnt/root ; gunzip $(ROOTFSUSERTARBALL); tar xpvf $(ROOTFSUSERTARBALL)'
  80. @echo 'cd /mnt/root ; mknod -m 644 console c 5 1'
  81. endif