How to flash SIM Cards for 5G SA
This tutorials explains how to flash SIM Cards which has the best chances of working in 5G SA on the test PLMN.
Install pysim
Install pysim:
laptop:~#
git clone https://github.com/osmocom/pysim
laptop:~# cd pysim
laptop:~/pysim# python -m venv env
laptop:~/pysim# source env/bin/activate
(env) laptop:~/pysim# pip install .
Change PLMN and IMSI
laptop:~/pysim# source env/bin/activate
(env) laptop:~/pysim# ./pySim-shell.py -p0
pySIM-shell (00:MF)>
verify_adm XXX
pySIM-shell (00:MF)>
select MF/ADF.USIM/EF.IMSI
pySIM-shell (00:MF)>
edit_binary_decoded
# Modify imsi and save
pySIM-shell (00:MF)>
select MF/ADF.USIM/EF.EHPLMN
pySIM-shell (00:MF)>
edit_binary_decoded
# Set mcc to "001" and mnc to "01"
pySIM-shell (00:MF)>
Use deactivate 5G if necessary
If the SIM Card doesn't work with your phone in 5G SA, then do the following setps:
laptop:~/pysim# source env/bin/activate
# Edit scripts/deactivate-5g.script to add your ADM after "verify_adm" command
(env) laptop:~/pysim# ./pySim-shell.py -p0 --script ./scripts/deactivate-5g.script
Add your SIM Cards to your core network
Follow this tutorial to authorize the SIM Card on your core network (if you are using the core network on the RapidSpace Panel):
https://handbook.rapid.space/ors/rapidspace-HowTo.Manage.Your.ORS.On.Panel
Click "Raw XML" and paste the following parameters:
<?xml version="1.0" encoding="UTF-8"?>
<instance>
<parameter id="_">{
"sim_algo": "milenage",
"imsi": "00101XXXXXXXXXX",
"opc": "XXX",
"amf": "0x9001",
"sqn": "000000000000",
"k": "XXX",
"impu": "00101XXXXXXXXXX",
"impi": "00101XXXXXXXXXX@ims.mnc001.mcc001.3gppnetwork.org"
}</parameter>
</instance>
Make sure to replace the "k" and "opc" fields with the values you got in the Sysmocom email, and put your IMSI at the right place in the "imsi", "impu" and "impi" fields.