Commit 92cbbaff authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Merged unified into qemu

--HG--
branch : qemu
......@@ -5,7 +5,7 @@
#http://www.gnu.org/software/make/manual/make.html#Automatic-Variables
#http://www.gnu.org/software/make/manual/make.html#Variables_002fRecursion
TOP_DIR=$(PWD)
TOP_DIR=.
include Makefile.setup
############################################################################################################
......@@ -105,9 +105,9 @@ clean:
# during 'make all'. We can't write 'zip: all docs' because
# of possible problem in case of parallel build.
# (see make's '-j' option documentation)
zip: docs
$(MAKE) all
cd $(PLATFORM_PATH)/all; $(MAKE) zip
#zip: docs
# $(MAKE) all
# cd $(PLATFORM_PATH)/all; $(MAKE) zip
docs:
cd $(PLATFORM_PATH)/all; $(MAKE) docs
......@@ -126,3 +126,7 @@ features.html: FORCE
FORCE:
# we want ML platforms to be built sequentially, to avoid conflicts
# => use .NOTPARALLEL in the upper-level Makefiles only
# parallel build is still used within each platform
.NOTPARALLEL:
......@@ -26,7 +26,12 @@ CONFIG_%$(_CONFIGS_clean_name):
CONFIG_%$(_CONFIGS_install_name): CONFIG_%$(_CONFIGS_compile_name)
+$(MAKE) -C $($*_DIR) install
install:: prepare_install_dir install_extra_data $(_CONFIGS_install)
# some installation media may fail when copying files in parallel
# broken drivers or controller? forcing sequential installation solves the issue...
# fixme: $(_CONFIGS_install) (currently just CONFIG_MODULES_install) does not run $(INSTALL_FINISH)
# it must be executed only once at the end (to unmount the installation media)
install:: prepare_install_dir install_extra_data
for target in $(_CONFIGS_install); do $(MAKE) $$target; done
$(INSTALL_FINISH)
install_extra_data: prepare_install_dir
......@@ -62,7 +67,7 @@ installdoc:
-$(CP) $(SRC_DIR)/logo.bmp $(INSTALL_ML_DIR)/docs || echo "warning Unable to copy logo.bmp"
prepare_zip: FORCE
$(eval INSTALL_DIR = $(PWD)/zip)
$(eval INSTALL_DIR = $(PWD_DIR)/zip)
$(eval INSTALL_PREPARE = )
$(eval INSTALL_FINISH = )
$(eval WIFI_SD = )
......@@ -72,11 +77,13 @@ prepare_zip: FORCE
$(eval export INSTALL_FINISH)
$(eval export WIFI_SD)
$(call rm_dir, $(INSTALL_DIR)/)
$(warning remove $(INSTALL_DIR))
$(warning removing $(INSTALL_DIR))
$(call rm_files, $(PLATFORM_PATH)/*/magiclantern.sym) # only check module dependencies on current camera model
$(warning removing $(PLATFORM_PATH)/*/magiclantern.sym)
mkdir -p $(INSTALL_DIR)
# zip.txt must be the first item on the list!
magiclantern-$(VERSION).zip: install installdoc install_fir
magiclantern-$(VERSION).zip: install installer_check installdoc
-$(call rm_files, $@)
chmod -x $(INSTALL_DIR)/autoexec.bin
cd $(INSTALL_DIR); zip -z ../$@ < \
......
......@@ -5,12 +5,16 @@ ifneq ("$(wildcard $(PREFERRED_ARM_PATH)/bin/arm-$(ARM_ABI)-gcc$(GCC_VERSION))",
ARM_BINPATH=$(PREFERRED_ARM_PATH)/bin
CROSS_COMPILE=$(ARM_BINPATH)/arm-$(ARM_ABI)-
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION)
$(info Using $(CC) (preferred).)
ifeq ("$(MAKELEVEL)","0")
$(info Using $(CC) (preferred).)
endif
else ifneq ("$(shell which arm-$(ARM_ABI)-gcc 2>/dev/null)","")
# otherwise, try whatever is installed on the system
CC=$(shell which arm-$(ARM_ABI)-gcc)
CROSS_COMPILE=$(shell basename '$(CC)' gcc)
$(info Using $(CC) (from PATH).)
ifeq ("$(MAKELEVEL)","0")
$(info Using $(CC) (from PATH).)
endif
else ifneq ("$(wildcard ~/gcc*arm*eabi*/bin/arm-$(ARM_ABI)-gcc$(GCC_VERSION))","")
# nothing found? look for any gcc*arm*eabi* in the home directory,
# matching ARM_ABI and GCC_VERSION from Makefile.user if specified
......@@ -18,7 +22,9 @@ else ifneq ("$(wildcard ~/gcc*arm*eabi*/bin/arm-$(ARM_ABI)-gcc$(GCC_VERSION))","
ARM_BINPATH=$(shell dirname `ls -v ~/gcc*arm*eabi*/bin/arm-$(ARM_ABI)-gcc$(GCC_VERSION) | tail -1`)
CROSS_COMPILE=$(ARM_BINPATH)/arm-$(ARM_ABI)-
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION)
$(info Using $(CC) (found in home directory).)
ifeq ("$(MAKELEVEL)","0")
$(info Using $(CC) (found in home directory).)
endif
else
# still nothing?
$(info )
......
......@@ -9,7 +9,7 @@ DATE=date -u
BINARIES_PATH=binaries
LUA_PATH=$(TOP_DIR)/lua
PWD=$(shell pwd)
PWD_DIR=$(shell pwd)
SRC_DIR=$(TOP_DIR)/src
PLATFORM_PATH=$(TOP_DIR)/platform
BUILDER_DIR=$(TOP_DIR)/../dumper
......@@ -19,6 +19,7 @@ CROP_DIR=$(TOP_DIR)/data/cropmks
VRAM_DIR=$(TOP_DIR)/data/vram
SCRIPT_DIR=$(TOP_DIR)/scripts
MODULES_DIR=$(TOP_DIR)/modules
INSTALLER_DIR=$(TOP_DIR)/installer
BIN_FILES=magiclantern magiclantern.bin autoexec.bin autoexec
CF_CARD_ML_DIR = $(CF_CARD)/ML
......@@ -69,3 +70,11 @@ endef
define targets_rules
$(foreach model, $1, $(model)_rule_$(strip $(2)))
endef
# evaluate once and only when used
# https://stackoverflow.com/a/28542922
# example: FOO = $(call eval_once,FOO,$(shell command))
define eval_once
$(eval $1 := $2)$(value $1)
endef
......@@ -14,7 +14,7 @@ else
# some distros may require:
# UMOUNT=sudo umount
# CF_CARD=/media/EOS_DIGITAL
CF_CARD:=$(shell mount | grep -oE "[^ ]+/EOS_DIGITAL[^ ]*")
CF_CARD = $(call eval_once,CF_CARD,$(shell mount | grep -oE "[^ ]+/EOS_DIGITAL[^ ]*"))
STAT_CMD=stat -c "%n: %s bytes"
endif
......@@ -45,9 +45,10 @@ ifeq ($(WIFI_SD),y)
# executed before installation
# connect to WIFI_CARD_NETWORK if not already,
# and mount card directory via WebDAV
# also monitor the connection in background while the card is mounted (signal tends to be weak)
INSTALL_PREPARE=$(call build,WIFI_SET,\
if !(nmcli conn show --active | grep $(WIFI_CARD_NETWORK) > /dev/null); then \
while !(nmcli device wifi list | grep $(WIFI_CARD_NETWORK)); do \
if ! nmcli conn show --active | grep $(WIFI_CARD_NETWORK) > /dev/null; then \
while ! nmcli device wifi list | grep $(WIFI_CARD_NETWORK); do \
if [ `nmcli radio wifi` = disabled ]; \
then nmcli radio wifi on; sleep 5; \
else nmcli dev wifi rescan 2>/dev/null || true; sleep 2; \
......@@ -60,14 +61,22 @@ ifeq ($(WIFI_SD),y)
if ping -c 3 -l 3 -W 1 $(WIFI_CARD_IP) > /dev/null; then break; fi; \
echo -n "."; \
done; \
if (ping -c 3 -l 3 -W 1 $(WIFI_CARD_IP) > /dev/null) ; then \
if !(gio mount -l | grep "dav://$(WIFI_CARD_IP)/"); then \
if ping -c 3 -l 3 -W 1 $(WIFI_CARD_IP) > /dev/null; then \
if ! gio mount -l | grep "dav://$(WIFI_CARD_IP)/"; then \
gio mount dav://$(WIFI_CARD_IP)/ ; \
fi; \
else \
echo "$(WIFI_CARD_IP) appears to be offline." ; \
exit 1; \
fi; )
fi; \
( while gio mount -l | grep -q "dav://$(WIFI_CARD_IP)/"; do \
if ! ping -c 3 -l 3 -W 1 $(WIFI_CARD_IP) > /dev/null; then \
echo -n "!"; \
fi; \
sleep 1; \
done \
) & \
)
# restore connection to your main wifi network
# or just turn it off if you are using a wired network
......@@ -75,18 +84,22 @@ ifeq ($(WIFI_SD),y)
if [ "$(WIFI_MAIN_NETWORK)" = "" ]; then \
echo "Turning off Wi-Fi..."; \
nmcli radio wifi off; \
elif !(nmcli conn show --active | grep $(WIFI_MAIN_NETWORK) > /dev/null); then \
elif ! nmcli conn show --active | grep $(WIFI_MAIN_NETWORK) > /dev/null; then \
echo "Connecting to $(WIFI_MAIN_NETWORK)..."; \
nmcli conn up $(WIFI_MAIN_NETWORK); \
fi; )
UMOUNT_CARD=$(call build,UNMOUNT,while !(gio mount -u dav://$(WIFI_CARD_IP)/); do sleep 2; done)
UMOUNT_CARD=$(call build,UNMOUNT,\
while ! gio mount -u dav://$(WIFI_CARD_IP)/; do \
sleep 2; \
done \
)
# executed after installation
define INSTALL_FINISH =
$(UMOUNT_CARD)
$(WIFI_RESTORE)
@printf "\nFinished.\nMake sure the camera will not write anything to the card until restart."
@printf "\nFinished.\nMake sure the camera will not write anything to the card until restart.\n"
endef
endif
......@@ -188,7 +201,7 @@ RST2LATEX=rst2latex.py
# magiclantern-0.2.0.rc1.550d.fw109.zip
#~ VERSION=0.2.0.rc1.550d.fw109
BUILDVER=$(shell whoami).$(shell hg id -i -r .)
VERSION:=Nightly.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION)
VERSION = $(call eval_once,VERSION,Nightly.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION))
# Build configuration - untested and debug stuff handy for devs
# these can be specified either in Makefile.user, or in the command line:
......
......@@ -4,6 +4,7 @@ ifndef TOP_DIR
# if this is used as a standalone makefile, we need to include some additional stuff
TOP_DIR=..
include $(TOP_DIR)/Makefile.setup
XOR_CHK:=$(notdir $(XOR_CHK))
endif
$(XOR_CHK): $(XOR_CHK).c
......
......@@ -114,23 +114,35 @@ menus.append("Other")
menus.append("Internals")
porting_threads = {
'5D' : 'http://www.magiclantern.fm/forum/index.php?topic=1010.0',
'5DC' : 'http://www.magiclantern.fm/forum/index.php?topic=1010.0',
'5D2' : 'http://www.magiclantern.fm/forum/index.php?topic=11205.0',
'5D3' : 'http://www.magiclantern.fm/forum/index.php?topic=11017.0',
'6D' : 'http://www.magiclantern.fm/forum/index.php?topic=3904.0',
'5D3.123' : 'http://www.magiclantern.fm/forum/index.php?topic=11017.0',
'5D3.113' : 'http://www.magiclantern.fm/forum/index.php?topic=14704.0',
'5D4' : 'http://www.magiclantern.fm/forum/index.php?topic=17695.0',
'6D' : 'http://www.magiclantern.fm/forum/index.php?topic=15088.0',
'7D' : 'http://www.magiclantern.fm/forum/index.php?topic=9848.0',
'7D2' : 'http://www.magiclantern.fm/forum/index.php?topic=13746.0',
'40D' : 'http://www.magiclantern.fm/forum/index.php?topic=1452.0',
'50D' : 'http://www.magiclantern.fm/forum/index.php?topic=9852.0',
'60D' : 'http://www.magiclantern.fm/forum/index.php?topic=5653.0',
'70D' : 'http://www.magiclantern.fm/forum/index.php?topic=8419.0',
'60D' : 'http://www.magiclantern.fm/forum/index.php?topic=14739.0',
'70D' : 'http://www.magiclantern.fm/forum/index.php?topic=14309.0',
'80D' : 'http://www.magiclantern.fm/forum/index.php?topic=17360.0',
'450D' : 'http://www.magiclantern.fm/forum/index.php?topic=8119.0',
'500D' : 'http://www.magiclantern.fm/forum/index.php?topic=11864.0',
'550D' : 'http://www.magiclantern.fm/forum/index.php?topic=5582.0',
'600D' : 'http://www.magiclantern.fm/forum/index.php?topic=12010.0',
'550D' : 'http://www.magiclantern.fm/forum/index.php?topic=13111.0',
'600D' : 'http://www.magiclantern.fm/forum/index.php?topic=15360.0',
'650D' : 'http://www.magiclantern.fm/forum/index.php?topic=7473.0',
'700D' : 'http://www.magiclantern.fm/forum/index.php?topic=5951.0',
'100D' : 'http://www.magiclantern.fm/forum/index.php?topic=5529.0',
'750D' : 'http://www.magiclantern.fm/forum/index.php?topic=17627.0',
'760D' : 'http://www.magiclantern.fm/forum/index.php?topic=16052.0',
'100D' : 'http://www.magiclantern.fm/forum/index.php?topic=16040.0',
'EOSM' : 'http://www.magiclantern.fm/forum/index.php?topic=9741.0',
'EOSM2' : 'http://www.magiclantern.fm/forum/index.php?topic=15895.0',
'1000D' : 'http://www.magiclantern.fm/forum/index.php?topic=2054.0',
'1100D' : 'http://www.magiclantern.fm/forum/index.php?topic=1009.0',
'1200D' : 'http://www.magiclantern.fm/forum/index.php?topic=12627.0',
'1300D' : 'http://www.magiclantern.fm/forum/index.php?topic=17969.0',
}
friendly_names = {}
......
......@@ -25,3 +25,8 @@ $(INSTALLER_INSTALL_TARGETS) $(INSTALLER_INSTALLER_TARGETS) $(INSTALLER_CLEAN_AL
$(call call_make_rule, $(TOP_DIR)/installer)
.PHONY: $(INSTALLER_INSTALLER_TARGETS) $(INSTALLER_INSTALL_TARGETS) $(INSTALLER_CLEAN_ALL_TARGETS) $(SUPPORTED_INSTALLERS)
# we want ML installers to be built sequentially, to avoid conflicts
# => use .NOTPARALLEL in the upper-level Makefiles only
# parallel build is still used within each platform
.NOTPARALLEL:
......@@ -4,26 +4,39 @@ ML_SETUP_EXTENSION=modules
include $(TOP_DIR)/Makefile.setup
MODULES_ALL_TARGETS = $(ML_MODULES_DYNAMIC) $(ML_MODULES_STATIC)
ifdef ML_MODULES_DYNAMIC
$(error ML_MODULES_DYNAMIC was renamed to ML_MODULES)
endif
MODULES_CLEAN_ALL_TARGETS = $(call targets_rules, $(shell ls -d */), clean)
MODULES_ALL_TARGETS = $(ML_MODULES)
MODULES_INSTALL_DYNAMIC_TARGETS = $(call targets_rules, $(ML_MODULES_DYNAMIC), install)
MODULES_CLEAN_ALL_TARGETS = $(call targets_rules, $(ML_MODULES), clean)
MODULES_ALL_TARGETS_DELETE_IF_FAILED = $(call targets_rules, $(MODULES_ALL_TARGETS), delete_if_failed)
MODULES_INSTALL_ALL_TARGETS = $(call targets_rules, $(ML_MODULES), install)
MODULES_ALL_TARGETS_DELETE_IF_FAILED = $(call targets_rules, $(ML_MODULES), delete_if_failed)
all:
@make --silent all_silent
@+$(MAKE) --silent all_silent
all_silent: $(MODULES_ALL_TARGETS_DELETE_IF_FAILED)
# run module-specific clean rules
# also run a generic clean, just in case there are any modules left over
clean: $(MODULES_CLEAN_ALL_TARGETS)
$(call rm_files, $(addprefix $(MODULES_DIR)/, *.o *.d *.dep *.sym hgstamp))
install: | prepare_install_dir
install: all
$(CP) $(MODULES_DIR)/*/*.mo $(INSTALL_MODULES_DIR)/ || echo "no problem"
$(CP) $(MODULES_DIR)/*/*.mo $(INSTALL_MODULES_DIR)/
$(MODULES_INSTALL_DYNAMIC_TARGETS) $(MODULES_CLEAN_ALL_TARGETS) $(ML_MODULES_DYNAMIC) $(MODULES_ALL_TARGETS_DELETE_IF_FAILED):
$(MODULES_INSTALL_ALL_TARGETS) $(MODULES_CLEAN_ALL_TARGETS) $(MODULES_ALL_TARGETS) $(MODULES_ALL_TARGETS_DELETE_IF_FAILED):
$(call call_make_rule, $(MODULES_DIR))
.PHONY: $(MODULES_ALL_TARGETS)
# force sequential execution at top level
# fixme: modules cannot be safely built in parallel, as dependency checks may fail
# e.g. mlv_snd depends on mlv_rec, but the former usually gets compiled quicker
# however, parallel build will still be used within each module
.NOTPARALLEL:
......@@ -23,13 +23,13 @@ nodep:: $(MODULE_OUTPUT) $(MODULE_SYM)
delete_if_failed:
@echo ""
@echo "Building module $(MODULE_NAME)..."
@make all --no-print-directory || { \
@$(MAKE) all --no-print-directory || { \
echo ""; \
echo "********************************************************"; \
echo "WARNING: module $(MODULE_NAME) failed to build, deleting"; \
echo "********************************************************"; \
echo ""; \
make clean; \
$(MAKE) clean; \
}
-include $(MODULE_DEPS)
......@@ -38,12 +38,14 @@ clean::
$(call rm_files, $(MODULE_OBJS) $(MODULE_OUTPUT) $(MODULE_SYM) $(MODULE_DEP) $(MODULE_STRINGS) $(HGDIFF_OBJS) *.o *.d *.dep *.sym hgstamp)
module_strings.h: README.rst hgstamp
$(call build,README, $(PYTHON) ../readme2modulestrings.py > $@)
$(call build,README, $(PYTHON) ../readme2modulestrings.py > $@ || rm -f $@)
README.rst:
$(call build,README,echo -e "$(MODULE_NAME)\n========\n\nPlease write a one-page description for your module here.\n\nYou may also add some metadata:\n\n:Author: <your name here>\n:License: <your license here>\n:Website: <your website here>\n\n" > $@)
$(call build,README,printf "$(MODULE_NAME)\n========\n\nPlease write a one-page description for your module here.\n\nYou may also add some metadata:\n\n:Author: <your name here>\n:License: <your license here>\n:Website: <your website here>\n\n" > $@)
$(MODULE_OUTPUT): $(MODULE_STRINGS) $(MODULE_OBJS) $(HGDIFF_OBJS)
$(MODULE_OBJS): $(MODULE_STRINGS)
$(MODULE_OUTPUT): $(MODULE_OBJS) $(HGDIFF_OBJS)
$(call build,MODULE,$(LD) -r -o $@ $(MODULE_OBJS))
$(call build,STRIP,$(STRIP) --strip-debug --strip-unneeded --discard-all --discard-locals $@)
$(call build,OBJCOPY,$(OBJCOPY) --add-section .module_hgdiff=hgdiff.tmp $@)
......@@ -78,14 +80,14 @@ hgdiff.tmp: FORCE
%.dep: %.mo
$(call build,DEPENDS,$(READELF) -sW $< | $(GREP) GLOBAL | $(GREP) 00000000 | $(GREP) UND | $(AWK) "{print \$$8;}" | sort > $@ && cd $(MODULES_DIR) && $(PYTHON) checkdep.py $(MODULE_NAME))
# redefine this in module makefile to install additional data along with your module
install_user_data::
modules_install_dir: install_prepare
$(call build,MKDIR,$(MKDIR) -p $(INSTALL_MODULES_DIR))
# redefine this in module makefile to install additional data along with your module
install_user_data:: | modules_install_dir
install:: modules_install_dir all install_user_data
$(call build,$(MODULE_OUTPUT),$(CP) $(PWD)/$(MODULE_OUTPUT) $(INSTALL_MODULES_DIR)/)
$(call build,$(MODULE_OUTPUT),$(CP) $(PWD_DIR)/$(MODULE_OUTPUT) $(INSTALL_MODULES_DIR)/)
$(INSTALL_FINISH)
FORCE:
......@@ -94,7 +96,7 @@ include $(TOP_DIR)/Makefile.filerules
# force recompiling whenever hg history changes (for autogenerated strings)
# http://mercurial.selenic.com/wiki/VersioningWithMake
HGVERSION:= $(shell hg log . -r 'reverse(ancestors(.))' -l 1 --template 'hgid: {node|short}')
HGVERSION = $(shell hg log . -r 'reverse(ancestors(.))' -l 1 --template 'hgid: {node|short}')
hgstamp: FORCE
@[ -f $@ ] || touch $@
@echo $(HGVERSION) | cmp -s $@ - || ( echo $(HGVERSION) > $@ ; echo "Updated HGVERSION" )
......
MODULE_CFLAGS += -I../../src/
ML_MODULES_STATIC ?=
ML_MODULES_DYNAMIC ?= \
ML_MODULES ?= \
mlv_lite \
mlv_play \
mlv_rec \
......
......@@ -62,6 +62,11 @@ def get_command_of(commands):
for command in commands:
if is_command_available(command) == True:
return command
print >> sys.stderr, "\nCould not find " + "/".join(commands) + "."
if "rst2html" in commands:
print >> sys.stderr, "Please install python-docutils (pip install docutils)."
print >> sys.stderr, ""
exit(1)
inp = open("README.rst").read().replace("\r\n", "\n")
lines = inp.strip("\n").split("\n")
......
......@@ -99,6 +99,14 @@ static unsigned int sf_dump_init()
SF_flash_size = 0x800000;
}
if (is_camera("6D", "1.1.6"))
{
SF_CreateSerial = (void*) 0xFF1471CC;
SF_readSerialFlash = (void*) 0xFF147174;
SF_Destroy = (void*) 0xFF149BB8;
SF_flash_size = 0x800000;
}
if (!SF_CreateSerial || !SF_readSerialFlash || !SF_Destroy)
{
console_show();
......
......@@ -21,3 +21,15 @@ FIR-SLAVE: autoexec-fir-slave
# $(call build,OBJCOPY,$(OBJCOPY) -O binary autoexec-fir $@.bin)
# $(STAT_CMD) $@.bin;
# $(READELF) -l autoexec-fir | grep -C 2 MemSiz
all::
$(MAKE) -C $(PLATFORM_PATH)/7D_MASTER.203
# special build_fir target
build_fir: all
$(MAKE) -C $(PLATFORM_PATH)/7D_MASTER.203 autoexec-fir.bin
python $(TOP_DIR)/../dumper/build_fir7.py -r \
-s $(PLATFORM_PATH)/7D.203/autoexec-fir.bin \
-m $(PLATFORM_PATH)/7D_MASTER.203/autoexec-fir.bin \
$(TOP_DIR)/../dumper/7D000203.FIR \
$(UPDATE_NAME_FIR)
......@@ -5,7 +5,8 @@
#define CANON_SHUTTER_RATING 150000
#define CARD_LED_ADDRESS 0xC022D06C // http://magiclantern.wikia.com/wiki/Led_addresses
/* turning the LED on/off requires writing two values to the register */
#define LEDON 0x138000
#define LEDOFF 0x38400
#define CARD_A_MAKER 0x8748F
#define CARD_A_MODEL 0x874c3
......
......@@ -14,19 +14,17 @@ TOP_DIR=..
#
include Makefile.platform.map
$(foreach _,$(PLATFORM_MAP),$(eval $(call makerule,$(word 1, $(subst ., ,$_)),$_,./)))
#
# we want ML platforms to be built sequentially, to avoid conflicts
# => use .NOTPARALLEL in the upper-level Makefiles only
# parallel build is still used within each platform
.NOTPARALLEL:
#
############################################################################################################
include $(TOP_DIR)/Makefile.setup
.PHONY: clean
clean:
.PHONY: install
install:
beautify-stubs:
for f in */stubs.S ; do python ../contrib/stub-format/stub-format.py $$f $$f; done
......
......@@ -20,9 +20,6 @@ $(warning FW_VERSION for $(MODEL) is not defined)
endif
endif
#not used?
ML_VERSION=unified1
ifndef ML_MODEL_DIR
ML_MODEL_DIR = $(MODEL).$(FW_VERSION)
endif
......@@ -31,7 +28,19 @@ PLATFORM_DIR=$(PLATFORM_PATH)/$(ML_MODEL_DIR)
PLATFORM_INC=$(PLATFORM_DIR)
# must have 8.3 characters for 64GB EXFAT cards
UPDATE_NAME_FIR=ML-SETUP.FIR
# installer (enable boot flag, make card bootable etc)
INSTALLER_NAME_FIR=ML-SETUP.FIR
# same thing as autoexec.bin, just run as FIR
# it's not auto-loaded, just named the same so you know it does the same thing
ML_NAME_FIR=AUTOEXEC.FIR
ifeq ($(ML_SRC_PROFILE),installer)
UPDATE_NAME_FIR=$(INSTALLER_NAME_FIR)
else
UPDATE_NAME_FIR=$(ML_NAME_FIR)
endif
ifndef ML_MAKEFILE_PLATFORM_SETUP
ML_MAKEFILE_PLATFORM_SETUP = $(PLATFORM_DIR)/Makefile.platform.default
......
......@@ -25,6 +25,7 @@ endif
$(CANON_FIR_PATH) $(ML_BUILD_FIR_PLATFORM_FILE) $(UPDATE_NAME_FIR) $(FIRMWARE_ID))
endif
@# don't worry if we can't build a FIR - just use the precompiled one
-$(ML_INSTALLER_BUILD_FIR)
install_fir: build_fir
......@@ -34,3 +35,32 @@ clean_fir::
$(call rm_files, $(ML_BUILD_FIR_PLATFORM_FILE) $(UPDATE_NAME))
clean_install_fir: install_fir | clean_fir
# do we have a valid installer directory?
ifneq ("$(wildcard $(INSTALLER_DIR)/$(ML_MODEL_DIR)/Makefile)","")
# build ML-SETUP.FIR from the installer directory
# note: a precompiled ML-SETUP.FIR is supplied by default; this will not rebuild it
# to force rebuilding, run "make ML-SETUP.FIR -B"
$(INSTALLER_NAME_FIR):
$(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) build_fir
$(CP) $(INSTALLER_DIR)/$(ML_MODEL_DIR)/$(INSTALLER_NAME_FIR) $@
# just to make sure the installer can be compiled from source
# do not actually build the FIR - just the plain binary
installer_check:
$(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) autoexec-fir.bin
# install ML-SETUP.FIR built from the installer directory
install:: $(INSTALLER_NAME_FIR)
$(CP) $(INSTALLER_NAME_FIR) $(INSTALL_DIR)/
else
# dummy target
installer_check:
$(info )
$(info $@: no installer for $(ML_MODEL_DIR).)
$(info )
endif
......@@ -32,40 +32,36 @@ platform_version = $(word 2, $(subst ., ,$(filter $(1).%, $(PLATFORM_MAP))))
# $2 model name with version (5D3.113)
# $3 directory prefix with trailing slash (e.g. 'platform/')
define makerule
.PHONY: $1
.PHONY: $1_clean
.PHONY: $2
.PHONY: $2_clean
.PHONY: $2_install
.PHONY: all clean zip check
.PHONY: $1 $1_clean $1_zip $1_install $1_install_qemu
.PHONY: $2 $2_clean $2_zip $2_install $2_install_qemu $2_check $2_autoexec_fir
# append to global all, clean and install targets
# append to global all, clean and zip targets
all: $2
clean: $2_clean
install: $2_install
zip: $2_zip
check: $2_check
# build the firmware-agnostic make rule, e.g. 5D3 or 5D2 and link to the firmware-specific rule
$1: $2
$1_clean: $2_clean
$1_zip: $2_zip
$1_install: $2_install
$1_install_qemu: $2_install_qemu
$2:
+$(MAKE) -C $3$2
$2_zip:
+$(MAKE) -C $3$2 zip
$2_clean:
+$(MAKE) -C $3$2 clean
$2_install:
+$(MAKE) -C $3$2 install
$2_install_qemu:
+$(MAKE) -C $3$2 install_qemu
$2_check:
@echo $2: $$(shell $$(READELF) -l $3$2/magiclantern 2>/dev/null | $$(GREP) -C 2 MemSiz | $$(GREP) -v EXIDX | $$(GREP) LOAD )
$2_autoexec_fir:
+$(MAKE) -C $3$2 autoexec-fir.bin
endef
# specific firmware versions/tweaks go here
7D: 7D_MASTER
$(MAKE) -C $(PLATFORM_PATH)/7D.203
7DFIR: 7D_MASTER 7D
dd if=$(PLATFORM_PATH)/7D.203/autoexec.bin of=$(PLATFORM_PATH)/7D.203/autoexec.fir bs=288 skip=1 >/dev/null 2>&1
dd if=$(PLATFORM_PATH)/7D_MASTER.203/autoexec.bin of=$(PLATFORM_PATH)/7D_MASTER.203/autoexec.fir bs=288 skip=1 >/dev/null 2>&1
python ../dumper/build_fir7.py -r -s $(PLATFORM_PATH)/7D.203/autoexec.fir -m $(PLATFORM_PATH)/7D_MASTER.203/autoexec.fir $(PLATFORM_PATH)/7D.203/7D000203.FIR $(PLATFORM_PATH)/7D.203/MAGIC.FIR >/dev/null
......@@ -102,6 +102,7 @@ LFLAGS += \
-u strstr \
-u strtof \
-u log10f \
-u log2f \
-u localeconv \
-u asinf \
-u strerror \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment