blob: 6b1c86cd8dfaf986c3a3f792d1d6e6ad28d83654 (
plain)
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
|
#!/bin/sh
set -u
set -e
. "${BR2_EXTERNAL_PIAUDIO_PATH}/board/common.sh"
# Add a console on tty1
if [ -e ${TARGET_DIR}/etc/inittab ]; then
grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
sed -i '/GENERIC_SERIAL/a\
tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab
fi
# Put the whole system in readonly
sed -ie '/^\/dev\/root/ s/rw 0 1/ro 0 0/' "${TARGET_DIR}/etc/fstab"
###########################
# #
# Network configuration #
# #
###########################
# Add default wpa_supplicant.conf if it exists
if [ -f "$BR2_EXTERNAL_PIAUDIO_PATH/wpa_supplicant.conf" ]; then
create_missing_dir "/etc/wpa_supplicant/"
cat "$BR2_EXTERNAL_PIAUDIO_PATH/wpa_supplicant.conf" > "${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant-wlan0.conf"
cat << __EOF__ > "${TARGET_DIR}/etc/systemd/network/wireless.network"
[Match]
Name=wlan0
[Network]
DHCP=yes
__EOF__
# Create the link to interface wlan0 directly in the system configuration
ln -sf /usr/lib/systemd/system/wpa_supplicant@.service "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service"
fi
##############################
# #
# Pulseaudio configuration #
# #
##############################
# Create the directory where pulseaudio store its files and put it in tempfs
create_missing_dir "/var/lib/pulse"
if ! grep -qE '/var/lib/pulse' "${TARGET_DIR}/etc/fstab"; then
cat << __EOF__ >> "${TARGET_DIR}/etc/fstab"
tmpfs /var/lib/pulse tmpfs rw 0 0
__EOF__
fi
if ! grep -qE '^load-module module-native-protocol-tcp' "${TARGET_DIR}/etc/pulse/system.pa"; then
cat << __EOF__ >> "${TARGET_DIR}/etc/pulse/system.pa"
load-module module-bluetooth-policy
load-module module-bluetooth-discover
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24;2a01:e35:8ac8:0e00::/64 auth-anonymous=1
__EOF__
fi
#############################
# #
# Bluetooth configuration #
# #
#############################
create_missing_dir "/etc/bluetooth/"
cat << __EOF__ > "${TARGET_DIR}/etc/bluetooth/main.conf"
[General]
Class = 200428
DiscoverableTimeout = 0
PairableTimeout = 0
[Policy]
AutoEnable=true
__EOF__
cat << __EOF__ > "${TARGET_DIR}/etc/systemd/system/bt-agent.service"
[Unit]
Description=Bluetooth Agent
After=bluetooth.service
Requires=bluetooth.service
[Service]
Type=simple
ExecStartPre=bt-adapter --set Discoverable 1
ExecStart=bt-agent -c NoInputNoOutput
RestartSec=5
Restart=always
KillSignal=SIGUSR1
[Install]
WantedBy=bluetooth.target
__EOF__
# The same for the bluetooth, as bluetoothd keep a track for each paired device
create_missing_dir "/var/lib/bluetooth/"
if ! grep -qE '/var/lib/bluetooth' "${TARGET_DIR}/etc/fstab"; then
cat << __EOF__ >> "${TARGET_DIR}/etc/fstab"
tmpfs /var/lib/bluetooth tmpfs rw 0 0
__EOF__
fi
mkdir -p "${TARGET_DIR}"/etc/systemd/system/getty.target.wants
# Add a console on ttyAMA0 and enable auto login
ln -sf /usr/lib/systemd/system/serial-getty@.service "${TARGET_DIR}"/etc/systemd/system/getty.target.wants/serial-getty@ttyGS0.service
sed '/^ExecStart=/ s/-o .-p -- ..u./--skip-login --noclear --noissue --login-options "-f root"/' -i "${TARGET_DIR}"/usr/lib/systemd/system/serial-getty@.service
|