Project

General

Profile

TestingInfrastructure » History » Version 55

Denis 'GNUtoo' Carikli, 04/27/2022 02:11 AM

1 31 Denis 'GNUtoo' Carikli
{{<toc}}
2
3 1 Denis 'GNUtoo' Carikli
h1. TestingInfrastructure
4
5 18 Denis 'GNUtoo' Carikli
h2. Applications that can be used to do some testing on the device
6
7
* https://f-droid.org/wiki/page/org.zeroxlab.zeroxbenchmark
8
9 5 Denis 'GNUtoo' Carikli
h2. Projects and/or hardware that can be used to do functional testing
10 1 Denis 'GNUtoo' Carikli
11
h3. Lava
12
13 7 Denis 'GNUtoo' Carikli
"Lava":https://www.linaro.org/engineering/projects/lava/ can be used to do functional tests on real hardware. It can be easily installed on PureOS, an FSDG compliant GNU/Linux distribution.
14 4 Denis 'GNUtoo' Carikli
15 23 Denis 'GNUtoo' Carikli
h3. Labgrid
16
17 24 Denis 'GNUtoo' Carikli
"Labgrid":https://labgrid.readthedocs.io/en/latest/ has features similar to Lava but it is probably easier to learn because it's probably way easier to get started with it.
18 23 Denis 'GNUtoo' Carikli
19 5 Denis 'GNUtoo' Carikli
h3. OsmoGSMTester
20 3 Denis 'GNUtoo' Carikli
21 6 Denis 'GNUtoo' Carikli
The "OsmoGSMTester project":https://osmocom.org/projects/osmo-gsm-tester is able to be interfaced with the Android RIL through ofono and can emulate a GSM network with the help of a compatible GSM base station or SDR.
22 3 Denis 'GNUtoo' Carikli
23 22 Denis 'GNUtoo' Carikli
24
This "presentation from 2019":https://media.ccc.de/v/osmodevcon2019-119-osmo-gsm-tester-e-gprs-test-setup has many insights on what kind of issue we might expect in interfacing it with smartphones.
25
26 5 Denis 'GNUtoo' Carikli
h3. Simtrace2
27 3 Denis 'GNUtoo' Carikli
28 1 Denis 'GNUtoo' Carikli
The "Simtrace 2 project":https://osmocom.org/projects/simtrace2/wiki can be used, along with SIM card readers to programmatically feed a SIM card to a smartphone. This can be used to run test on real networks.
29 7 Denis 'GNUtoo' Carikli
30
h2. Replicant supported devices and testing
31
32
h3. Requirements
33
34 8 Denis 'GNUtoo' Carikli
* Antenna connector for the modem
35 10 Denis 'GNUtoo' Carikli
* The ability to control the device buttons in order to be able to programmatically power on and off the device, and trigger boots into the bootloader and recovery
36 11 Denis 'GNUtoo' Carikli
* Optionally a way to connect to the serial port, programmatically
37 1 Denis 'GNUtoo' Carikli
38 36 Denis 'GNUtoo' Carikli
h3. Galaxy SII (GT-I9100)
39 7 Denis 'GNUtoo' Carikli
40 36 Denis 'GNUtoo' Carikli
* The Galaxy SII (GT-I9100) has:
41 35 Denis 'GNUtoo' Carikli
** An antenna connector. According to the "External Antenna Socket - WARNING forum thread on XDA":https://forum.xda-developers.com/t/external-antenna-socket-warning.1273292/page-6 , it's an MS-162
42 10 Denis 'GNUtoo' Carikli
** The SOC serial port that is accessible behind the USB connector at a low voltage
43 12 Denis 'GNUtoo' Carikli
** A full size mini-sim (easier to interface with)
44
45 13 Denis 'GNUtoo' Carikli
Holding the smartphone in place:
46
* The smartphone could either be screwed on a metallic surface or an external case could be screwed on a metallic surface enabling the smartphone not to move.
47 1 Denis 'GNUtoo' Carikli
48 13 Denis 'GNUtoo' Carikli
SIM cards:
49 37 Denis 'GNUtoo' Carikli
* Simtrace and Simtrace 2 both "lacks screw holes":https://osmocom.org/issues/3711 so a way must be found to make sure that it doesn't move as it uses flex cables to interface with the SIM socket of the smartphone. That may be fixed in a subsequent hardware revision.
50 1 Denis 'GNUtoo' Carikli
51 13 Denis 'GNUtoo' Carikli
Serial port and USB:
52 1 Denis 'GNUtoo' Carikli
53 13 Denis 'GNUtoo' Carikli
Buttons:
54 12 Denis 'GNUtoo' Carikli
55 13 Denis 'GNUtoo' Carikli
Battery:
56
57
Antenna connector and GSM tower or SDR:
58 36 Denis 'GNUtoo' Carikli
The Galaxy SII (GT-I9100) has two antenna connectors:
59 15 Denis 'GNUtoo' Carikli
* One internal connector, TODO: find the connector type
60
* One external connector, TODO: Find the connector type
61 16 Denis 'GNUtoo' Carikli
62
h4. Example setup
63
64 36 Denis 'GNUtoo' Carikli
See also the links inside the [[Serial_port]] article for more background on how to get serial port access on devices like the Galaxy SIII (GT-I9300) or the Galaxy SII (GT-I9100).
65 20 Denis 'GNUtoo' Carikli
66 17 Denis 'GNUtoo' Carikli
!i9100.jpg!
67
68 19 Denis 'GNUtoo' Carikli
See https://git.replicant.us/contrib/GNUtoo/test-infrastructure.git for the source of the file.
69
70 25 Denis 'GNUtoo' Carikli
h4. Using a device without a battery.
71 1 Denis 'GNUtoo' Carikli
72 25 Denis 'GNUtoo' Carikli
* "How to use a Galaxy SIII without a battery":https://techblog.jeppson.org/2017/12/revive-old-samsung-galaxy-s3/ : It doesn't look very safe to do that as the phone is probably not expecting 5V on the battery connector but it gives some idea of the peak tolerances.
73
74 36 Denis 'GNUtoo' Carikli
* The Galaxy SIII 4G (GT-I9305) could probably work at lower voltages like 3.3V through the battery connector, but it would require testing it. In that case it might also be a good idea to test it in all configurations (all hardware features being used, cpuburn etc).
75 29 Denis 'GNUtoo' Carikli
76 36 Denis 'GNUtoo' Carikli
* The 4 pin 'FPC' style battery connector available from amazon, marketed as being for the 'S4 value edition i9515' (https://amazon.de/gp/product/B0813JBW8S) is capable of contacting the Galaxy SIII (GT-I9300)'s battery.
77 32 Denis 'GNUtoo' Carikli
78 38 Denis 'GNUtoo' Carikli
h4. Sumarry 
79
80
| Device                  | Modem antenna connector | Compatible software       | Comments                                                                                                  |                         
81
| Motorolla C155          | MS-147                  | * OsmocomBB
82
                                                      * Old Nuttx revisions     | Could be used as reference phone as it's probably already supported by the Osmocom testing infrastructure |
83
| Galaxy SII (GT-I9100)   | MS-162                  | * Replicant 4.0, 4.2, 6.0
84
                                                     * Upstream Linux (partial) |
85
| Galaxy Nexus (GT-I9250) | ?                       | * Replicant 4.0, 4.2, 6.0 | We can get some GSM traces in wireshark with xgoldmon                                                     |
86
| Galaxy SIII (GT-I9300)  | ?                       | * Replicant 4.0, 4.2, 6.0
87
                                                     * Upstream Linux (partial) |
88
89 32 Denis 'GNUtoo' Carikli
h2. USB modems
90
91 34 Denis 'GNUtoo' Carikli
When [[XMMProtocolInterfaces|trying to enable protocol tracing in modems]] we can connect the device modem (somewhat directly) to a laptop
92 32 Denis 'GNUtoo' Carikli
93
Questions:
94
* Do we have samsung-ipc on top of the virtual UARTs?
95
* The cbd daemon mentioned "in the blog post about booting the Galaxy S7 modem":https://eighty-twenty.org/2020/09/10/booting-samsung-galaxy-s7-modem  doesn't list UART as main link though.
96
* Adding the modem USB id when in debug mode (1519:0020) in a search engine shows various usb keys
97
* Do phones like the Galaxy SII have smasung-ipc on top of the USB link or UART links when in debug mode?
98 39 Denis 'GNUtoo' Carikli
99
h2. Pure software setup
100
101
h3. lightweight test infrastructure for libsamsung-ipc
102
103
It might be possible to have a pure software test infrastructure with libsamsung-ipc.
104
105
It could be done more or less like that:
106
107
test script <-> ipc-modem or other programs <-> libsamsung-ipc <-> Linux kernel <-> VHCI <-> software sending USB packets
108
109
We have several choices for the Linux kernel:
110
111
| Kernels                   | Comments |
112 51 Denis 'GNUtoo' Carikli
| User mode Linux (ARCH=um) | + Very lightweight, runs completely in userspace
113
                              + Very simple setup. Probably works on armv7 too without dedicated hardware like Intel vt-x
114 54 Denis 'GNUtoo' Carikli
                                -Requires patches for USB / VHCI-
115 51 Denis 'GNUtoo' Carikli
                              - Require dedicated RAM                                                                      |
116
| Linux + libvirt + kvm     | - Require some virtualization setup that requires dedicated RAM 
117
                              + Probably works unpatched                                                                 |
118 39 Denis 'GNUtoo' Carikli
119
And there is already some projects emulating usb devices:
120 53 Denis 'GNUtoo' Carikli
| Project                     | Description               |   comments                         |
121
| gnuk                        | USB token software        | can build for gnulinux             |
122
| choptix                     | Library used by gnuk      | More simple examples               |
123
| osmo-ccid-firmware[1][2][3] | CCID emulation            | Probably uses vusb for testing too |
124 1 Denis 'GNUtoo' Carikli
125 52 Denis 'GNUtoo' Carikli
126 53 Denis 'GNUtoo' Carikli
fn1. https://git.osmocom.org/osmo-ccid-firmware/tree/ccid_host
127
128
fn2. https://git.osmocom.org/osmo-ccid-firmware/tree/ccid_host/README.linux-dummy_hcd-ffs
129
130
fn3. https://media.ccc.de/v/osmodevcon2019-128-osmo-ccid-firmware-libosmocore-talloc-on-uc-usb-testing-from-ttcn-3
131 39 Denis 'GNUtoo' Carikli
132
So it might be possible to modify them to send some simple USB packets captured with wireshark / tshark / tcpdump.
133 41 Denis 'GNUtoo' Carikli
134
h4. user mode Linux
135
136
I've already managed to find a configuration that works in an FSDG compliant way:
137 45 Denis 'GNUtoo' Carikli
| Settings                                                                      | Status           |
138 41 Denis 'GNUtoo' Carikli
| *kernel*: kernel_replicant_linux 
139 49 Denis 'GNUtoo' Carikli
  *commit*: 843565d21f78 [WIP] ARM: dts: exynos: Add reboot modes to midas
140 41 Denis 'GNUtoo' Carikli
  *compilation settings*: ARCH=um
141
  *Host architecture*: x86_64
142 1 Denis 'GNUtoo' Carikli
  *kernel defconfig*: x86_64_defconfig
143 42 Denis 'GNUtoo' Carikli
  *Target Distribution*: Parabola x86_64
144 1 Denis 'GNUtoo' Carikli
  *commandline arguments*: ./linux mem=2047M ubd0=parabola.img root=/dev/ubda1  | Boots fine          |
145 49 Denis 'GNUtoo' Carikli
| *kernel*: kernel_replicant_linux
146
  *commit*: 063228e445e2 net: sipc: core: fix code style
147 1 Denis 'GNUtoo' Carikli
  *compilation settings*: ARCH=um
148 49 Denis 'GNUtoo' Carikli
  *Host architecture*: i686
149 1 Denis 'GNUtoo' Carikli
  *kernel defconfig*: i386_defconfig                                            | Fails to compile[1] |
150 49 Denis 'GNUtoo' Carikli
| *kernel*: linux
151
  *commit*: f1baf68e1383 Merge tag 'net-5.17-rc4' of [...]kernel/git/netdev/net
152
  *compilation settings*: ARCH=um
153
  *Host architecture*: x86_64
154
  *kernel defconfig*: i386_defconfig                                            | Boots fine          |
155 45 Denis 'GNUtoo' Carikli
| *Target Distribution*: Replicant 11
156 1 Denis 'GNUtoo' Carikli
  *Build command*: source build/envsetup.sh && lunch uml-userdebug && make dist
157
  *kernel*: ?
158 46 Denis 'GNUtoo' Carikli
  *kernel defconfig*: ?                                                         | Fails to compile[2] |
159 1 Denis 'GNUtoo' Carikli
160 48 Denis 'GNUtoo' Carikli
fn1. <pre>
161
  CC      arch/x86/um/user-offsets.s
162
cc1: error: code model ‘large’ not supported in the 32 bit mode
163
cc1: sorry, unimplemented: 64-bit mode not compiled in
164
make[1]: *** [scripts/Makefile.build:117: arch/x86/um/user-offsets.s] Error 1
165
make: *** [arch/um/Makefile:118: archprepare] Error 2
166
</pre>
167 1 Denis 'GNUtoo' Carikli
168 48 Denis 'GNUtoo' Carikli
fn2. <pre>[ 52% 179/339] including external/mesa3d/Android.mk ...
169
FAILED: 
170
In file included from build/make/core/prebuilt.mk:53:
171
In file included from external/mesa3d/Android.mk:124:
172
In file included from external/mesa3d/src/mesa/Android.mk:23:
173
external/mesa3d/src/mesa/Android.libmesa_glsl_utils.mk:74: error: BUILD_HOST_STATIC_LIBRARY is obsolete. Please convert to Soong.
174
12:25:14 ckati failed with: exit status 1
175
176
#### failed to build some targets (02:04 (mm:ss)) ####
177
</pre>
178 41 Denis 'GNUtoo' Carikli
179 44 Denis 'GNUtoo' Carikli
h5. Booting Parabola
180
181 43 Denis 'GNUtoo' Carikli
To run Parabola first you need to create an image.
182
Then you need to chroot (with arch-chroot) insde the image and change the password.
183
Once you exited the chroot and unmounted the image and removed the loop mapping, you can boot it.
184
185
During boot you'll see a message like that at the end:
186
<pre>
187
Virtual console 1 assigned device '/dev/pts/4'
188
</pre>
189
190
You can then login in this way:
191
<pre>
192
$ sudo picocom /dev/pts/4 
193
picocom v3.1
194
195
port is        : /dev/pts/4
196
flowcontrol    : none
197
baudrate is    : 9600
198
parity is      : none
199
databits are   : 8
200
stopbits are   : 1
201
escape is      : C-a
202
local echo is  : no
203
noinit is      : no
204
noreset is     : no
205
hangup is      : no
206
nolock is      : no
207
send_cmd is    : sz -vv
208
receive_cmd is : rz -vv -E
209
imap is        : 
210
omap is        : 
211
emap is        : crcrlf,delbs,
212
logfile is     : none
213
initstring     : none
214
exit_after is  : not set
215
exit is        : no
216
217
Type [C-a] [C-h] to see available commands
218
Terminal ready
219
220
parabola login: root
221
Password: 
222
[root@parabola ~]# cat /etc/os-release 
223
NAME="Parabola"
224
PRETTY_NAME="Parabola GNU/Linux-libre"
225
ID=parabola
226
ID_LIKE=arch
227
BUILD_ID=rolling
228
ANSI_COLOR="1;35"
229
HOME_URL="https://www.parabola.nu/"
230
DOCUMENTATION_URL="https://wiki.parabola.nu/"
231
SUPPORT_URL="irc://chat.freenode.net#parabola"
232
BUG_REPORT_URL="https://labs.parabola.nu/"
233
LOGO=parabola
234
[root@parabola ~]# 
235
</pre>
236 1 Denis 'GNUtoo' Carikli
237 54 Denis 'GNUtoo' Carikli
h5. network support
238
239
With @vec0:transport=raw,ifname=p-veth0,depth=128,gro=1@ in Linux command line, we can have a regular Ethernet interface that can be configured as usual, bridges also work.
240
241
See the kernel documentation (user_mode_linux_howto_v2.rst) for more details on how to setup UML networking.
242
243
h5. USB support
244
245
With Linux 5.17-rc3 it's possible to have USB in user-mode-linux and I validated it by exporting an rtl_sdr with usbip and testing the receiving of FM with rtl_fm -f 88M | hexdump -C.
246
247
It seems to be there since Linux 5.14 since this commit:
248
  68f5d3f3b654 um: add PCI over virtio emulation driver
249
250
Unfortunately we use Linux 5.10.70 in replicant 11 right now.
251
252 1 Denis 'GNUtoo' Carikli
h5. User Mode Linux TODO
253
254 41 Denis 'GNUtoo' Carikli
* We probably need to make i686 and armv7 to work too.
255 54 Denis 'GNUtoo' Carikli
* -We also need to setup USB somehow with vhci_hcd and so on-
256
* We need to make USB work with Replicant 11 kernel or upgrade the Replicant 11 kernel.
257 41 Denis 'GNUtoo' Carikli
* We still need to find a very simple stack to send URBs.
258 54 Denis 'GNUtoo' Carikli
* We then need to test it for real, see if we can collect kernel crashes in this way and so on.
259 55 Denis 'GNUtoo' Carikli
* We also need to package user-mode-linux in Parabola or other FSDG distributions to make testing easier.