ext2root.mk 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #############################################################
  2. #
  3. # genext2fs to build to target ext2 filesystems
  4. #
  5. #############################################################
  6. GENEXT2_DIR=$(BUILD_DIR)/genext2fs-1.3.orig
  7. GENEXT2_SOURCE=genext2fs_1.3.orig.tar.gz
  8. GENEXT2_SITE=http://ftp.debian.org/debian/pool/main/g/genext2fs
  9. GENEXT2_PATCH=$(SOURCE_DIR)/genext2fs.patch
  10. $(DL_DIR)/$(GENEXT2_SOURCE):
  11. wget -P $(DL_DIR) --passive-ftp $(GENEXT2_SITE)/$(GENEXT2_SOURCE)
  12. $(GENEXT2_DIR): $(DL_DIR)/$(GENEXT2_SOURCE) $(GENEXT2_PATCH)
  13. zcat $(DL_DIR)/$(GENEXT2_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  14. cat $(GENEXT2_PATCH) | patch -p1 -d $(GENEXT2_DIR)
  15. $(GENEXT2_DIR)/genext2fs: $(GENEXT2_DIR)
  16. $(MAKE) CFLAGS="-Wall -O2 -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64" -C $(GENEXT2_DIR);
  17. touch -c $(GENEXT2_DIR)/genext2fs
  18. genext2fs: $(GENEXT2_DIR)/genext2fs
  19. #############################################################
  20. #
  21. # Build the ext2 root filesystem image
  22. #
  23. # Known problems :
  24. # - genext2fs: couldn't allocate a block (no free space)
  25. #
  26. # Since genext2fs allocates only one group of blocks, the FS
  27. # size is limited to a maximum of 8 Mb.
  28. #
  29. #############################################################
  30. # FIXME -- calculate these numbers...
  31. SIZE=8000
  32. INODES=1000
  33. ext2root: genext2fs #$(shell find $(TARGET_DIR) -type f)
  34. -@find $(TARGET_DIR)/lib -type f -name \*.so\* | xargs $(STRIP) --strip-unneeded 2>/dev/null || true;
  35. -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true;
  36. $(GENEXT2_DIR)/genext2fs -i $(INODES) -b $(SIZE) -d $(TARGET_DIR) -D $(SOURCE_DIR)/device_table.txt $(IMAGE)
  37. ext2root-source: $(DL_DIR)/$(GENEXT2_SOURCE)
  38. ext2root-clean:
  39. -make -C $(GENEXT2_DIR) clean
  40. ext2root-dirclean:
  41. rm -rf $(GENEXT2_DIR)