Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
  9. kernel-install:
  10. $(KERNEL_CROSS)objcopy $(OSTRIP) -S $(LINUX_DIR)/vmlinux \
  11. $(BIN_DIR)/${DEVICE}-${ARCH}-kernel
  12. createinit:
  13. $(SED) 's#^CONFIG_INITRAMFS_SOURCE.*#CONFIG_INITRAMFS_SOURCE="./initramfs_list"#' $(LINUX_DIR)/.config
  14. echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config
  15. echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config
  16. $(MAKE) -C $(LINUX_DIR) V=0 CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(ARCH) \
  17. CC="$(TARGET_CC)" $(MAKE_TRACE)
  18. $(CP) $(LINUX_DIR)/arch/mips/loongson/image/vmlinuz \
  19. $(BIN_DIR)/${DEVICE}-${ARCH}-kernel
  20. ifeq ($(FS),nfsroot)
  21. imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL)
  22. @echo 'The kernel file is: ${BIN_DIR}/${DEVICE}-${ARCH}-kernel'
  23. @echo 'The nfs root tarball is: ${BIN_DIR}/${ROOTFSTARBALL}'
  24. @echo 'Boot your lemote and type following commands in PMON:'
  25. @echo 'PMON> ifaddr rtl0 <ip-address-client>'
  26. @echo 'PMON> load tftp://<ip-address-server>/lemote-mips-kernel'
  27. @echo 'PMON> g no_auto_cmd root=/dev/nfs ip=dhcp init=/init'
  28. endif
  29. ifeq ($(FS),encrypted)
  30. imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL) createinit
  31. @echo 'The kernel+cryptinit file is: ${BIN_DIR}/${DEVICE}-${ARCH}-kernel'
  32. @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL),"
  33. @echo 'Boot your lemote via NFS or USB.'
  34. @echo 'Then create at least three partitions with fdisk:'
  35. @echo '/dev/sda1 (ext2)'
  36. @echo '/dev/sda2 (encrypted root)'
  37. @echo '/dev/sda3 (swap)'
  38. @echo 'mkdir /mnt/{boot,root}'
  39. @echo 'mke2fs /dev/sda1'
  40. @echo 'cryptsetup luksFormat /dev/sda2'
  41. @echo 'cryptsetup luksFormat /dev/sda3'
  42. @echo 'cryptsetup luksOpen /dev/sda2 root'
  43. @echo 'cryptsetup luksOpen /dev/sda3 swap'
  44. @echo 'mkfs.xfs /dev/mapper/root'
  45. @echo 'mkswap /dev/mapper/swap'
  46. @echo 'mount /dev/sda1 /mnt/boot'
  47. @echo 'mount /dev/mapper/crypt /mnt/root'
  48. @echo 'mkdir /mnt/boot/boot'
  49. @echo
  50. @echo 'Copy $(ROOTFSTARBALL) via scp to /mnt/root and extract it'
  51. @echo 'cd /mnt/root ; gunzip $(ROOTFSTARBALL); tar xpvf $(ROOTFSTARBALL)'
  52. @echo 'Copy ${DEVICE}-${ARCH}-kernel via scp to /mnt/boot/boot'
  53. @echo 'Move boot.cfg to /mnt/boot/boot'
  54. @echo 'mv /mnt/root/boot/boot.cfg /mnt/boot/boot'
  55. @echo 'cd /mnt/root ; mknod -m 644 console c 5 1'
  56. endif
  57. ifeq ($(FS),initramfs)
  58. imageinstall: $(BIN_DIR)/$(INITRAMFS)
  59. @echo 'The kernel file is: ${BIN_DIR}/${DEVICE}-${ARCH}-kernel'
  60. @echo 'The initramfs image is: ${BIN_DIR}/${INITRAMFS}'
  61. endif
  62. ifeq ($(FS),ext2)
  63. imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL)
  64. @echo
  65. @echo 'The kernel file is: ${BIN_DIR}/${DEVICE}-${ARCH}-kernel'
  66. @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL),"
  67. endif