summaryrefslogtreecommitdiff
path: root/utils/nwztools/scripts/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'utils/nwztools/scripts/Makefile')
-rw-r--r--utils/nwztools/scripts/Makefile71
1 files changed, 54 insertions, 17 deletions
diff --git a/utils/nwztools/scripts/Makefile b/utils/nwztools/scripts/Makefile
index 590fe775ba..36ccfbb496 100644
--- a/utils/nwztools/scripts/Makefile
+++ b/utils/nwztools/scripts/Makefile
@@ -5,36 +5,73 @@ scsitool:="../scsitools/scsitool"
5 5
6all: 6all:
7 @echo "Please select an action:" 7 @echo "Please select an action:"
8 @echo "- update: uses script update.sh"
9 @echo "- dump_rootfs: dumps the root filesystem to rootfs.tgz" 8 @echo "- dump_rootfs: dumps the root filesystem to rootfs.tgz"
10 @echo "- my_update: craft an arbitrary upgrade script found in my_update.sh" 9 @echo "- do_fw_upgrade: put the device in NWZ_DEV in firmware upgrade mode"
11 @echo "- do_fw_upgrade: send a firmware upgrade to the device in NWZ_DEV" 10 @echo "- copy_fw_upgrade: copy firmware to a device with the right name"
11 @echo "- exec_file: craft an upgrade that executes a script/executable"
12 @echo "- list_targets: produce of list of available targets" 12 @echo "- list_targets: produce of list of available targets"
13 13
14my_update: my_update.upg 14ifndef UPG
15dump_rootfs: dump_rootfs.upg 15want_upg:
16 $(info Please set UPG to the upg filename. For example:)
17 $(info make exec_file UPG=hello_world.upg ...)
18 $(error "")
19else
20want_upg: ;
21endif
22
23ifndef EXEC
24want_exec:
25 $(info Please set EXEC to the executable filename. For example:)
26 $(info make exec_file EXEC=hello_world.sh ...)
27 $(error "")
28else
29want_exec: ;
30endif
16 31
17%.upg: %.sh
18ifndef NWZ_TARGET 32ifndef NWZ_TARGET
19 @echo "Please set NWZ_TARGET to your target. For example:" 33want_target:
20 @echo "make $@ NWZ_TARGET=nwz-e463" 34 $(info Please set NWZ_TARGET to your target. For example:)
21 @echo "Run 'make list_targets' to get a list of all targets" 35 $(info make dump_rootfs NWZ_TARGET=nwz-e463)
36 $(info Run 'make list_targets' to get a list of all targets)
37 $(error "")
22else 38else
23 @echo "Target: $(NWZ_TARGET)" 39want_target: ;
24 $(upgtool) -c -m $(NWZ_TARGET) $@ $^
25endif 40endif
26 41
42ifndef NWZ_DEV
43want_dev:
44 $(info Please set NWZ_DEV to your dev. For example:)
45 $(info make do_fw_upgrade NWZ_DEV=/dev/sdx)
46else
47want_dev: ;
48endif
49
50ifndef NWZ_MOUNT
51want_mount:
52 $(info Please set NWZ_MOUNT to your dev mount point. For example:)
53 $(info make copy_fw_upgrade NWZ_MOUNT=/media/WALKMAN ...)
54else
55want_mount: ;
56endif
57
58UPGPACK=$(upgtool) -c -m $(NWZ_TARGET) $(UPG) $(1)
59
60exec_file: want_target want_exec want_upg
61 $(call UPGPACK, exec_file.sh $(EXEC))
62
63dump_rootfs: want_target want_upg
64 $(call UPGPACK, dump_rootfs.sh)
65
27clean: 66clean:
28 rm -rf *.upg 67 rm -rf *.upg
29 68
30list_targets: 69list_targets:
31 $(upgtool) -m ?; true # upgtool returns an error in this case, ignore it 70 $(upgtool) -m ?; true # upgtool returns an error in this case, ignore it
32 71
33do_fw_upgrade: 72copy_fw_upgrade: want_upg want_mount
34ifdef NWZ_DEV 73 cp $(UPG) "$(NWZ_MOUNT)/NW_WM_FW.UPG"
74
75do_fw_upgrade: want_dev
35 @echo "Device: $(NWZ_DEV)" 76 @echo "Device: $(NWZ_DEV)"
36 $(scsitool) $(NWZ_DEV) do_fw_upgrade 77 $(scsitool) $(NWZ_DEV) do_fw_upgrade
37else
38 @echo "Please set NWZ_DEV to your dev. For example:"
39 @echo "make do_fw_upgrade NWZ_DEV=/dev/sdx"
40endif