Skip to content

Commit 29697c7

Browse files
committed
now possible to make prod image (assembly tests at first boot) with make image-prod
1 parent 311a200 commit 29697c7

File tree

8 files changed

+28
-21
lines changed

8 files changed

+28
-21
lines changed

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/assembly_tests

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/bin/sh
22

33
## Check if tests must be run
4-
RUN_FILE=/mnt/.assembly_tests
54
RUN_ENV_VAR=$(fw_printenv -n assembly_tests 2>/dev/null)
6-
if [ ! -f ${RUN_FILE} -a "x${RUN_ENV_VAR}" != "x1" ]; then
7-
#echo "${RUN_FILE} not present, not performing assembly tests."
5+
if [ "x${RUN_ENV_VAR}" != "x1" ]; then
86
exit 0
97
fi
108

@@ -360,7 +358,7 @@ ro
360358
## Exit processes
361359
if ! $test_failed; then
362360
## Remove run file => no assembly tests on next run
363-
rm -f ${RUN_FILE}
361+
fw_setenv assembly_tests 0
364362
sync
365363
exit 0
366364
else

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ format_backing_store_partition () {
129129
}
130130

131131
copy_files_to_store_partition () {
132-
# Add file to force assembly tests
132+
# Add file to force assembly tests
133+
134+
133135
mount /mnt/ || die 18 "Cannot mount /mnt"
134-
#touch /mnt/.assembly_tests || die 19 "Cannot create assembly tests run file"
135136
unzip -q -o /usr/local/share/mnt_freware_games.zip -d /mnt/
136137
umount /mnt/ || die 20 "Cannot unmount /mnt"
137138
return 0

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/sched_shutdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ nb_secs_to_wait=$1
99

1010
# Wait $nb_secs_to_wait seconds to catch signal USR2
1111
# If the signal is caught, then it means a process canceled this shutdown
12-
sleep ${nbl_secs_to_wait}
12+
sleep ${nb_secs_to_wait}
1313

1414
# Too late to cancel: init shutdown
1515
shutdown_funkey

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/signal_usr1_to_emulators

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# This should replaced by storing the correct PID before
33
# launching an emulator and signaling only this one.
44

5-
6-
if [[ -f /mnt/.assembly_tests ]]; then
5+
RUN_ENV_VAR=$(fw_printenv -n assembly_tests 2>/dev/null)
6+
if [ "x${RUN_ENV_VAR}" == "x1" ]; then
77
# First this one
88
killall -s USR1 assembly_tests > /dev/null 2>&1
99

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ image: fun
8181
@./Recovery/output/host/bin/genimage --loglevel 0 --inputpath .
8282
@rm -rf root tmp
8383

84+
85+
image-prod: fun
86+
@$(call MESSAGE,"Creating disk image")
87+
@rm -rf root tmp
88+
@mkdir -p root tmp
89+
@./Recovery/output/host/bin/genimage --loglevel 0 --config "genimage-prod.cfg" --inputpath .
90+
@rm -rf root tmp
91+
8492
update: fun
8593
@$(call MESSAGE,"Creating update file")
8694
@rm -rf tmp

Recovery/board/funkey/post-build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,11 @@ mv ${TARGET_DIR}/etc/init.d/S50dropbear ${TARGET_DIR}/etc/init.d/S42dropbear
2222
rm -rf ${TARGET_DIR}/etc/dropbear
2323
ln -s /tmp ${TARGET_DIR}/etc/dropbear
2424

25-
# Generate U-Boot environment
25+
# Generate U-Boot environment for app
2626
${HOST_DIR}/bin/mkenvimage -p 0x0 -s 0x20000 -o ${BINARIES_DIR}/u-boot-env.img ${TARGET_DIR}/etc/u-boot.env
27+
28+
# Generate U-Boot environment for production
29+
cp ${TARGET_DIR}/etc/u-boot.env ${TARGET_DIR}/etc/u-boot-prod.env
30+
echo "assembly_tests=1" >> ${TARGET_DIR}/etc/u-boot-prod.env
31+
${HOST_DIR}/bin/mkenvimage -p 0x0 -s 0x20000 -o ${BINARIES_DIR}/u-boot-env-prod.img ${TARGET_DIR}/etc/u-boot-prod.env
32+
rm ${TARGET_DIR}/etc/u-boot-prod.env

Recovery/board/funkey/rootfs-overlay/etc/funkey_gpio_mapping.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
7+13, SHELL_COMMAND, quick_action_volume_down, Fn+A, Volume--
5454
7+11, SHELL_COMMAND, quick_action_bright_up, Fn+B, Brightness++
5555
7+14, SHELL_COMMAND, quick_action_bright_down, Fn+X, Brightness--
56-
10, SHELL_COMMAND, sched_shutdown 1 & signal_usr1_to_emulators, N_OE, Quick save and Poweroff because of N_OE
56+
10, SHELL_COMMAND, shutdown_funkey, N_OE, Poweroff because of N_OE
5757
7+15+2, SHELL_COMMAND, display_notif_system_stats, Fn+L1+L2, display system cpu and ram usage
5858

5959
#7+12, KEYBOARD, KEY_G, KEY_G, Brightness++

Recovery/board/funkey/rootfs-overlay/usr/local/sbin/menu

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ menu_display () {
6262

6363
# Factory tests enable/disable
6464
if [ -e /mnt/.assembly_tests ]; then
65-
message=" FACTORY TESTS DISABLE"
65+
message=" FACTORY TESTS DISABLE"
6666
else
67-
message=" FACTORY TESTS ENABLE"
67+
message=" FACTORY TESTS ENABLE"
6868
fi
6969
;;
7070

@@ -223,21 +223,15 @@ menu_run () {
223223
6)
224224

225225
# Factory tests enable/disable
226-
mount | grep -q /dev/mmcblk0p4
227-
if [ $? -eq 0 ]; then
228-
if [ -e /mnt/.assembly_tests ]; then
229-
rm -f /mnt/.assembly_tests
226+
RUN_ENV_VAR=$(fw_printenv -n assembly_tests 2>/dev/null)
227+
if [ "x${RUN_ENV_VAR}" == "x1" ]; then
230228
fw_setenv assembly_tests 0
231229
message=" FACTORY TESTS ENABLE"
232230
else
233-
#touch /mnt/.assembly_tests
234231
fw_setenv assembly_tests 1
235232
message=" FACTORY TESTS DISABLE"
236233
fi
237234
notif "${message}"
238-
else
239-
notif "${message}...^CANNOT TEST IF MOUNTED!"
240-
fi
241235
;;
242236

243237
7)

0 commit comments

Comments
 (0)