/
rcS
executable file
·130 lines (111 loc) · 4.05 KB
/
rcS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
#
# XCSoar Glide Computer - http://www.xcsoar.org/
# Copyright (C) 2000-2015 The XCSoar Project
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# This script is launched by /etc/inittab on boot. It initialises the
# Kobo Mini and launches XCSoar's KoboMenu.
/bin/mount -o remount,noatime,nodiratime /dev/mmcblk0p1 /
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022
# mount the data partition
/bin/dosfsck -a -w /dev/mmcblk0p3
/bin/mkdir -p /mnt/onboard
/bin/mount -t vfat -o iocharset=utf8 /dev/mmcblk0p3 /mnt/onboard
/bin/rm -rf /mnt/onboard/fsck* /mnt/onboard/FSCK*
# launch the original Kobo init script if:
# - there's a pending update
# - Nickel start was scheduled
# - the XCSoar installation is broken
if [ -f /mnt/onboard/.kobo/Kobo.tgz -o -f /mnt/onboard/.kobo/KoboRoot.tgz \
-o -f /mnt/onboard/XCSoarData/kobo/start_nickel \
-o ! -x /opt/xcsoar/bin/KoboMenu ]; then
rm -f /mnt/onboard/XCSoarData/kobo/start_nickel
# launch user script before nickel start
if [ -f /mnt/onboard/XCSoarData/kobo/init_nickel.sh ]; then
source /mnt/onboard/XCSoarData/kobo/init_nickel.sh
fi
umount -l /mnt/onboard
exec /etc/init.d/rcS
fi
# prepare file system
/bin/mkdir -p /proc /dev /root /tmp /sys /var/lib /var/log /var/run
/bin/mount -t proc none /proc
/bin/mount -t tmpfs none -o size=16m /tmp
/bin/mount -t tmpfs none /dev
/bin/mount -t tmpfs none -o size=16k /var/lib
/bin/mount -t tmpfs none -o size=16k /var/log
/bin/mount -t tmpfs none -o size=128k /var/run
/bin/mount -t sysfs none -o size=500k /sys
/bin/mknod /dev/null c 1 3
/bin/mknod /dev/zero c 1 5
/bin/mknod /dev/random c 1 8
/bin/mknod /dev/urandom c 1 9
/bin/mknod /dev/ptmx c 5 2
/bin/mkdir /dev/input
/bin/mknod /dev/input/event0 c 13 64
/bin/mknod /dev/input/event1 c 13 65
/bin/mknod /dev/fb0 c 29 0
/bin/mknod /dev/ttyACM0 c 166 0
/bin/mknod /dev/ttyACM1 c 166 1
/bin/mknod /dev/ttyACM2 c 166 2
/bin/mknod /dev/ttyACM3 c 166 3
/bin/mknod /dev/ttyACM4 c 166 4
/bin/mknod /dev/ttyACM5 c 166 5
/bin/mknod /dev/ttyACM6 c 166 6
/bin/mknod /dev/ttyACM7 c 166 7
/bin/mknod /dev/ttyACM8 c 166 8
/bin/mknod /dev/ttyACM9 c 166 9
/bin/mknod /dev/ttyUSB0 c 188 0
/bin/mknod /dev/ttyUSB1 c 188 1
/bin/mknod /dev/ttyUSB2 c 188 2
/bin/mknod /dev/ttyUSB3 c 188 3
/bin/mknod /dev/ttyUSB4 c 188 4
/bin/mknod /dev/ttyUSB5 c 188 5
/bin/mknod /dev/ttyUSB6 c 188 6
/bin/mknod /dev/ttyUSB7 c 188 7
/bin/mknod /dev/ttyUSB8 c 188 8
/bin/mknod /dev/ttyUSB9 c 188 9
/bin/mknod /dev/ttymxc0 c 207 16
/bin/mknod /dev/ttymxc1 c 207 17
/bin/mknod /dev/ttymxc2 c 207 18
/bin/mknod /dev/rtc0 c 254 0
/bin/mknod /dev/mmcblk0 b 179 0
/bin/mknod /dev/mmcblk0p1 b 179 1
/bin/mknod /dev/mmcblk0p2 b 179 2
/bin/mknod /dev/mmcblk0p3 b 179 3
/sbin/hwclock -s -u
# workaround for kernel crash "scheduling while atomic"
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
# disable the flashing led
echo "ch 3" > /sys/devices/platform/pmic_light.1/lit
echo "cur 0" > /sys/devices/platform/pmic_light.1/lit
echo "dc 0" > /sys/devices/platform/pmic_light.1/lit
# enable crash dumps
/bin/mkdir -p /mnt/onboard/XCSoarData/crash
echo '/mnt/onboard/XCSoarData/crash/core.%p' >/proc/sys/kernel/core_pattern
ulimit -c unlimited
# launch user script
if [ -f /mnt/onboard/XCSoarData/kobo/init.sh ]; then
source /mnt/onboard/XCSoarData/kobo/init.sh
fi
# workaround for Kobo Touch N905B kernel bug: the mxc_fb driver
# crashes when KoboMenu tries to rotate the display too early after
# boot
if [ `dd if=/dev/mmcblk0 bs=8 count=1 skip=64` = "SN-N905B" ]; then
sleep 1
fi
# finally, open the menu
exec /opt/xcsoar/bin/KoboMenu
# just in case launching KoboMenu fails: try xcsoar
exec /opt/xcsoar/bin/xcsoar