2016-08-17 20:26:12 +00:00
|
|
|
upgtool:="../upgtools/upgtool"
|
|
|
|
scsitool:="../scsitools/scsitool"
|
|
|
|
|
|
|
|
.SUFFIXES: # disable old suffix rules
|
|
|
|
|
|
|
|
all:
|
|
|
|
@echo "Please select an action:"
|
|
|
|
@echo "- dump_rootfs: dumps the root filesystem to rootfs.tgz"
|
2016-09-26 23:09:06 +00:00
|
|
|
@echo "- do_fw_upgrade: put the device in NWZ_DEV in firmware upgrade mode"
|
|
|
|
@echo "- copy_fw_upgrade: copy firmware to a device with the right name"
|
2016-10-19 15:02:41 +00:00
|
|
|
@echo "- exec_file: craft an upgrade that embeds and execute a file"
|
|
|
|
@echo "- exec_file_extern: craft an upgrade that execute a file on the user partition"
|
2016-08-17 20:26:12 +00:00
|
|
|
@echo "- list_targets: produce of list of available targets"
|
2016-11-01 16:04:26 +00:00
|
|
|
@echo "- install_dualboot"
|
2016-08-17 20:26:12 +00:00
|
|
|
|
2016-09-26 23:09:06 +00:00
|
|
|
ifndef UPG
|
|
|
|
want_upg:
|
|
|
|
$(info Please set UPG to the upg filename. For example:)
|
|
|
|
$(info make exec_file UPG=hello_world.upg ...)
|
|
|
|
$(error "")
|
|
|
|
else
|
|
|
|
want_upg: ;
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef EXEC
|
|
|
|
want_exec:
|
|
|
|
$(info Please set EXEC to the executable filename. For example:)
|
|
|
|
$(info make exec_file EXEC=hello_world.sh ...)
|
|
|
|
$(error "")
|
|
|
|
else
|
|
|
|
want_exec: ;
|
|
|
|
endif
|
2016-08-17 20:26:12 +00:00
|
|
|
|
|
|
|
ifndef NWZ_TARGET
|
2016-09-26 23:09:06 +00:00
|
|
|
want_target:
|
|
|
|
$(info Please set NWZ_TARGET to your target. For example:)
|
2016-11-01 16:04:26 +00:00
|
|
|
$(info make dump_rootfs NWZ_TARGET=nwz-e460)
|
2016-09-26 23:09:06 +00:00
|
|
|
$(info Run 'make list_targets' to get a list of all targets)
|
|
|
|
$(error "")
|
2016-08-17 20:26:12 +00:00
|
|
|
else
|
2016-09-26 23:09:06 +00:00
|
|
|
want_target: ;
|
2016-08-17 20:26:12 +00:00
|
|
|
endif
|
|
|
|
|
2016-09-26 23:09:06 +00:00
|
|
|
ifndef NWZ_DEV
|
|
|
|
want_dev:
|
|
|
|
$(info Please set NWZ_DEV to your dev. For example:)
|
|
|
|
$(info make do_fw_upgrade NWZ_DEV=/dev/sdx)
|
2016-10-19 15:02:41 +00:00
|
|
|
$(error "")
|
2016-09-26 23:09:06 +00:00
|
|
|
else
|
|
|
|
want_dev: ;
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef NWZ_MOUNT
|
|
|
|
want_mount:
|
|
|
|
$(info Please set NWZ_MOUNT to your dev mount point. For example:)
|
|
|
|
$(info make copy_fw_upgrade NWZ_MOUNT=/media/WALKMAN ...)
|
2016-10-19 15:02:41 +00:00
|
|
|
$(error "")
|
2016-09-26 23:09:06 +00:00
|
|
|
else
|
|
|
|
want_mount: ;
|
|
|
|
endif
|
|
|
|
|
2016-10-19 15:02:41 +00:00
|
|
|
ifndef LOG
|
|
|
|
want_log:
|
|
|
|
$(info Please set LOG to the log filename. For example:)
|
|
|
|
$(info make exec_file_extern LOG=exec.log ...)
|
|
|
|
$(error "")
|
|
|
|
else
|
|
|
|
want_log: ;
|
|
|
|
endif
|
|
|
|
|
2016-09-26 23:09:06 +00:00
|
|
|
UPGPACK=$(upgtool) -c -m $(NWZ_TARGET) $(UPG) $(1)
|
|
|
|
|
|
|
|
exec_file: want_target want_exec want_upg
|
|
|
|
$(call UPGPACK, exec_file.sh $(EXEC))
|
|
|
|
|
2016-11-01 16:04:26 +00:00
|
|
|
install_dualboot: want_target want_exec want_upg
|
|
|
|
$(call UPGPACK, install_dualboot.sh $(EXEC))
|
|
|
|
|
2016-10-19 15:02:41 +00:00
|
|
|
exec_file_extern.tmp: want_exec want_upg want_log
|
|
|
|
cat exec_file_extern.sh.in | sed "s|NWZ_EXEC_THIS|$(EXEC)|" |\
|
|
|
|
sed "s|NWZ_LOG_THIS|$(LOG)|" > $@
|
|
|
|
.INTERMEDIATE: exec_file_extern.tmp
|
|
|
|
|
|
|
|
exec_file_extern: want_target want_exec want_upg want_log exec_file_extern.tmp
|
|
|
|
$(call UPGPACK, exec_file_extern.tmp)
|
|
|
|
|
2016-09-26 23:09:06 +00:00
|
|
|
dump_rootfs: want_target want_upg
|
|
|
|
$(call UPGPACK, dump_rootfs.sh)
|
|
|
|
|
2016-08-17 20:26:12 +00:00
|
|
|
clean:
|
2016-08-20 14:05:58 +00:00
|
|
|
rm -rf *.upg
|
2016-08-17 20:26:12 +00:00
|
|
|
|
|
|
|
list_targets:
|
|
|
|
$(upgtool) -m ?; true # upgtool returns an error in this case, ignore it
|
|
|
|
|
2016-09-26 23:09:06 +00:00
|
|
|
copy_fw_upgrade: want_upg want_mount
|
|
|
|
cp $(UPG) "$(NWZ_MOUNT)/NW_WM_FW.UPG"
|
|
|
|
|
|
|
|
do_fw_upgrade: want_dev
|
2016-08-17 20:26:12 +00:00
|
|
|
@echo "Device: $(NWZ_DEV)"
|
|
|
|
$(scsitool) $(NWZ_DEV) do_fw_upgrade
|