#-------------------------------------------------------------- # # We need to run "make menuconfig" to get users options # and then we run make to create a distribution # #-------------------------------------------------------------- TOPDIR=./ CONFIG_CONFIG_IN = Config.in CONFIG_DEFCONFIG = .defconfig CONFIG = config PADS_CONFIG ?= .config export ARCH=powerpc export CROSS_COMPILE=ppc_4xxFP- # Pull in the user's configuration file ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) -include $(TOPDIR)$(PADS_CONFIG) endif TAR_OPTIONS=$(subst ",, $(PADS_TAR_OPTIONS)) -xf #" ifeq ($(strip $(PADS_HAVE_DOT_CONFIG)),y) TARGETS:="" include package/Makefile.in ############################################################# # # You should probably leave this stuff alone unless you know # what you are doing. # ############################################################# all: world #In this section, we neeed .config include .config.cmd # We explicitly specify the build order of the first targets, # otherwise with 'include package/*/*.mk' they all end up in # alphabetical order. The alternative is to use explicit dependencies # to define the build order, for example have the asterisk target # depend on linux. TARGETS+=toolchain linux skeleton busybox export PADS_VERSION=2.0.6-15 # We also need the various per-package makefiles which we add to TARGETS include package/*/*.mk target_debug: @echo "TARGETS=$(TARGETS)" TARGETS_CLEAN:=$(patsubst %,%-clean, $(TARGETS)) TARGETS_SOURCE:=$(patsubst %,%-source, $(TARGETS)) TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) TARGETS_IMAGE:=$(patsubst %,%-image,$(TARGETS)) ############################################################################# # Custom Path ############################################################################# TOOLS_BIN=$(BASE_DIR)/toolchain/usr/bin PATH:= /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin PATH:= $(PATH):$(TOOLS_BIN) world: prebuild clean_version_info $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ $(PERSISTENT_STORAGE) $(PERSISTENT1_STORAGE) $(PERSISTENT2_STORAGE) \ set_version_info $(TARGETS) .PHONY: all world clean dirclean distclean source clean_version_info set_version_info \ $(TARGETS) $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ $(TARGETS_IMAGE) $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) ############################################################# # # staging and target directories do NOT list these as # dependancies anywhere else # ############################################################# $(DL_DIR): @mkdir -p $(DL_DIR) $(BUILD_DIR): @mkdir -p $(BUILD_DIR) $(TOOL_BUILD_DIR): @mkdir -p $(TOOL_BUILD_DIR) $(STAGING_DIR): @mkdir -p $(STAGING_DIR)/lib @mkdir -p $(STAGING_DIR)/include @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) $(TARGET_DIR): mkdir -p $(TARGET_DIR) $(PERSISTENT_STORAGE): mkdir -p $(PERSISTENT_STORAGE) $(PERSISTENT1_STORAGE): mkdir -p $(PERSISTENT1_STORAGE) $(PERSISTENT2_STORAGE): mkdir -p $(PERSISTENT2_STORAGE) clean_version_info: @rm -f $(PERSISTENT_STORAGE)/version_info.txt set_version_info: @date > $(PERSISTENT_STORAGE)/version_info.txt @echo "PADS version " $(PADS_VERSION) >> $(PERSISTENT_STORAGE)/version_info.txt .PHONY: image ROOTFS_SIZE=130000 image: $(TARGETS_IMAGE) @if [ -n "`ls $(TARGET_DIR)/persistent/* 2>/dev/null`" ]; then \ rm -f .persistent_moved_to_flash; \ utils/persistent_to_flash.sh; \ touch .persistent_moved_to_flash; \ fi mkfs.jffs2 -n -b -p -r build_warp/persistent -e 131072 -o images/image.jffs2 @if [ -n "`ls build_warp/persistent1/* 2>/dev/null`" ]; then \ mkfs.jffs2 -n -b -p -r build_warp/persistent1 -e 131072 -o images/image1.jffs2; \ fi @if [ -n "`ls build_warp/persistent2/* 2>/dev/null`" ]; then \ mkfs.jffs2 -n -b -p -r build_warp/persistent2 -e 131072 -o images/image2.jffs2; \ fi genext2fs -U \ -d build_warp/root \ -b $(ROOTFS_SIZE) \ -i 2048 \ images/rootfs.img @gzip -v9 images/rootfs.img mkimage -T ramdisk -C gzip -n 'PIKA Warp $(PADS_VERSION)' \ -d images/rootfs.img.gz images/uRamdisk @rm images/rootfs.img.gz @if [ -f .persistent_moved_to_flash ]; then \ utils/persistent_to_nfs.sh; \ rm -f .persistent_moved_to_flash; \ fi @gcc -O3 -Wall utils/padit.c -o utils/padit @if test -f images/cuImage.warp; \ then cp -f images/cuImage.warp images/cuImage.warp.tmp; \ utils/padit images/cuImage.warp.tmp images/cuImage.warp; \ fi @cp -f images/uRamdisk images/uRamdisk.tmp @utils/padit images/uRamdisk.tmp images/uRamdisk @rm -f images/*.tmp @if [ `stat -c %s images/uRamdisk` -gt 50331648 ]; then \ echo; \ echo "WARNING!!!! Ramdisk image is too large and will not boot."; \ echo "Size must be less than 48M"; \ fi ########################################################### # # Cleanup # ########################################################## clean: $(TARGETS_CLEAN) dirclean: $(TARGETS_DIRCLEAN) rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE_DIR) $(PERSISTENT_STORAGE) \ $(PERSISTENT1_STORAGE) $(PERSISTENT2_STORAGE) else # ifeq ($(strip $(PADS_HAVE_DOT_CONFIG)),y) ######################################################### # # Configuration # ######################################################### all: menuconfig endif # ifeq ($(strip $(PADS_HAVE_DOT_CONFIG)),y) $(CONFIG)/conf: $(MAKE) -C $(CONFIG) conf $(CONFIG)/mconf: $(MAKE) -C $(CONFIG) ncurses conf mconf # If a file named prebuild is present, execute it. This file # is intended for user-specific steps. If steps should only # be executed once, the user script should include steps to # touch a file and then check for its existence before executing. prebuild: @if [ -f prebuild_steps.sh ]; then \ echo; \ if [ -x prebuild_steps.sh ]; then \ echo "Executing prebuild steps."; \ ./prebuild_steps.sh; \ echo; \ else \ echo "prebuild_steps.sh is not executable"; \ echo; \ exit 1; \ fi \ fi menuconfig: $(CONFIG)/mconf prebuild @utils/include_extra_packages.sh @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) @if [ -f .config ]; then \ ln -sf .config pads_config; \ fi defconfig: $(CONFIG)/conf prebuild @utils/include_extra_packages.sh @ln -sf pads_defconfig .defconfig $(CONFIG)/conf -d $(CONFIG_CONFIG_IN) @ln -sf .config pads_config oldconfig: $(CONFIG)/conf prebuild @utils/include_extra_packages.sh @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) @ln -sf .config pads_config