harddisk.mk 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #
  2. # Copyright (C) 2008-2010 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. define Image/BuildKernelMachId
  8. echo -en "\x$(2)\x1c\xa0\xe3\x$(3)\x10\x81\xe3" > $(KDIR)/$(1)-zImage
  9. cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/$(1)-zImage
  10. $(STAGING_DIR_HOST)/bin/mkimage -A arm -O linux -T kernel \
  11. -C none -a 0x00008000 -e 0x00008000 -n 'Linux-$(LINUX_VERSION)' \
  12. -d $(KDIR)/$(1)-zImage $(KDIR)/$(1)-uImage
  13. cp $(KDIR)/$(1)-uImage $(BIN_DIR)/openwrt-$(1)-uImage
  14. endef
  15. define Image/BuildKernel
  16. # Orion Kernel uImages
  17. # DT2: mach id 1514 (0x5EA)
  18. $(call Image/BuildKernelMachId,dt2,05,ea)
  19. # LaCie 2big Network: mach id 2342 (0x926)
  20. $(call Image/BuildKernelMachId,net2big,09,26)
  21. endef
  22. define Image/Build/Freecom
  23. # Orion Freecom Images
  24. # backup unwanted files
  25. rm -rf ${TMP_DIR}/$2_backup
  26. mkdir ${TMP_DIR}/$2_backup
  27. -mv $(TARGET_DIR)/{var,jffs,rom} ${TMP_DIR}/$2_backup
  28. # add extra files
  29. $(INSTALL_DIR) $(TARGET_DIR)/boot
  30. # TODO: Add special CMDLINE shim for webupgrade image here
  31. $(CP) $(KDIR)/dt2-uImage $(TARGET_DIR)/boot/uImage
  32. $(INSTALL_DIR) $(TARGET_DIR)/var
  33. # create image
  34. $(TAR) cfj $(BIN_DIR)/openwrt-$(2)-$(1).img --numeric-owner --owner=0 --group=0 -C $(TARGET_DIR)/ .
  35. $(STAGING_DIR_HOST)/bin/encode_crc $(BIN_DIR)/openwrt-$(2)-$(1).img $(BIN_DIR)/openwrt-$(2)-$(1)-webupgrade.img $(3)
  36. # remove extra files
  37. rm -rf $(TARGET_DIR)/{boot,var}
  38. # recover unwanted files
  39. -mv ${TMP_DIR}/$2_backup/* $(TARGET_DIR)/
  40. rm -rf ${TMP_DIR}/$2_backup
  41. endef
  42. define Image/Build
  43. $(call Image/Build/$(1),$(1))
  44. $(call Image/Build/Freecom,$(1),dt2,DT,$(1))
  45. endef
  46. define Image/Build/squashfs
  47. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  48. ( \
  49. dd if=$(KDIR)/uImage bs=1024k conv=sync; \
  50. dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
  51. ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
  52. endef