diff options
Diffstat (limited to 'utils/nwztools/scripts/Makefile')
-rw-r--r-- | utils/nwztools/scripts/Makefile | 71 |
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 | ||
6 | all: | 6 | all: |
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 | ||
14 | my_update: my_update.upg | 14 | ifndef UPG |
15 | dump_rootfs: dump_rootfs.upg | 15 | want_upg: |
16 | $(info Please set UPG to the upg filename. For example:) | ||
17 | $(info make exec_file UPG=hello_world.upg ...) | ||
18 | $(error "") | ||
19 | else | ||
20 | want_upg: ; | ||
21 | endif | ||
22 | |||
23 | ifndef EXEC | ||
24 | want_exec: | ||
25 | $(info Please set EXEC to the executable filename. For example:) | ||
26 | $(info make exec_file EXEC=hello_world.sh ...) | ||
27 | $(error "") | ||
28 | else | ||
29 | want_exec: ; | ||
30 | endif | ||
16 | 31 | ||
17 | %.upg: %.sh | ||
18 | ifndef NWZ_TARGET | 32 | ifndef NWZ_TARGET |
19 | @echo "Please set NWZ_TARGET to your target. For example:" | 33 | want_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 "") | ||
22 | else | 38 | else |
23 | @echo "Target: $(NWZ_TARGET)" | 39 | want_target: ; |
24 | $(upgtool) -c -m $(NWZ_TARGET) $@ $^ | ||
25 | endif | 40 | endif |
26 | 41 | ||
42 | ifndef NWZ_DEV | ||
43 | want_dev: | ||
44 | $(info Please set NWZ_DEV to your dev. For example:) | ||
45 | $(info make do_fw_upgrade NWZ_DEV=/dev/sdx) | ||
46 | else | ||
47 | want_dev: ; | ||
48 | endif | ||
49 | |||
50 | ifndef NWZ_MOUNT | ||
51 | want_mount: | ||
52 | $(info Please set NWZ_MOUNT to your dev mount point. For example:) | ||
53 | $(info make copy_fw_upgrade NWZ_MOUNT=/media/WALKMAN ...) | ||
54 | else | ||
55 | want_mount: ; | ||
56 | endif | ||
57 | |||
58 | UPGPACK=$(upgtool) -c -m $(NWZ_TARGET) $(UPG) $(1) | ||
59 | |||
60 | exec_file: want_target want_exec want_upg | ||
61 | $(call UPGPACK, exec_file.sh $(EXEC)) | ||
62 | |||
63 | dump_rootfs: want_target want_upg | ||
64 | $(call UPGPACK, dump_rootfs.sh) | ||
65 | |||
27 | clean: | 66 | clean: |
28 | rm -rf *.upg | 67 | rm -rf *.upg |
29 | 68 | ||
30 | list_targets: | 69 | list_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 | ||
33 | do_fw_upgrade: | 72 | copy_fw_upgrade: want_upg want_mount |
34 | ifdef NWZ_DEV | 73 | cp $(UPG) "$(NWZ_MOUNT)/NW_WM_FW.UPG" |
74 | |||
75 | do_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 |
37 | else | ||
38 | @echo "Please set NWZ_DEV to your dev. For example:" | ||
39 | @echo "make do_fw_upgrade NWZ_DEV=/dev/sdx" | ||
40 | endif | ||