try add workflow for wiki

This commit is contained in:
cuu 2024-04-08 22:35:10 -07:00
parent 14aa1d6e41
commit db46b97efc
9 changed files with 853 additions and 0 deletions

18
.github/workflows/publish-wiki.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Publish wiki
on:
push:
branches: [master]
paths:
- wiki/**
- .github/workflows/publish-wiki.yml
concurrency:
group: publish-wiki
cancel-in-progress: true
permissions:
contents: write
jobs:
publish-wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Andrew-Chen-Wang/github-wiki-action@v4

View File

@ -0,0 +1,72 @@
# Prepare
## In DevTerm or uConsole
uncomment deb-src in /etc/apt/source.list ,and run 'sudo apt update'
```
sudo apt install git build-essential libasound2-dev libudev-dev
sudo apt install -y libegl-mesa0
sudo apt-get build-dep retroarch
```
```
git clone https://github.com/libretro/RetroArch.git retroarch
```
```
cd retroarch
./configure --disable-videocore --disable-vg --enable-alsa --enable-udev --disable-opengl1
make
sudo make install
```
```
mkdir -p /usr/local/bin 2>/dev/null || /bin/true
mkdir -p /etc 2>/dev/null || /bin/true
mkdir -p /usr/local/share/applications 2>/dev/null || /bin/true
mkdir -p /usr/local/share/metainfo 2>/dev/null || /bin/true
mkdir -p /usr/local/share/doc/retroarch 2>/dev/null || /bin/true
mkdir -p /usr/local/share/man/man6 2>/dev/null || /bin/true
mkdir -p /usr/local/share/pixmaps 2>/dev/null || /bin/true
cp retroarch /usr/local/bin
cp tools/cg2glsl.py /usr/local/bin/retroarch-cg2glsl
cp retroarch.cfg /etc
cp com.libretro.RetroArch.appdata.xml /usr/local/share/metainfo
cp retroarch.desktop /usr/local/share/applications
cp docs/retroarch.6 /usr/local/share/man/man6
cp docs/retroarch-cg2glsl.6 /usr/local/share/man/man6
cp media/retroarch.svg /usr/local/share/pixmaps
cp COPYING /usr/local/share/doc/retroarch
cp README.md /usr/local/share/doc/retroarch
chmod 755 /usr/local/bin/retroarch
chmod 755 /usr/local/bin/retroarch-cg2glsl
chmod 644 /etc/retroarch.cfg
chmod 644 /usr/local/share/applications/retroarch.desktop
chmod 644 /usr/local/share/metainfo/com.libretro.RetroArch.appdata.xml
chmod 644 /usr/local/share/man/man6/retroarch.6
chmod 644 /usr/local/share/man/man6/retroarch-cg2glsl.6
chmod 644 /usr/local/share/pixmaps/retroarch.svg
```
# Modify the RetroArch configuration and download the corresponding core file, taking the Nestopia simulator as an example
```
sudo apt-get install wget unzip -y
sed -i '/^libretro_directory/c\libretro_directory = "~/.config/retroarch/cores"' ~/.config/retroarch/retroarch.cfg
wget https://github.com/christianhaitian/retroarch-cores/raw/master/aarch64/nestopia_libretro.so.zip && unzip nestopia_libretro.so.zip -d ~/.config/retroarch/cores && rm nestopia_libretro.so.zip
```
# apt upgrade stock retroarch for DevTerm / uConsole
```
sudo apt update
sudo apt install -y retroarch-cpi-cm4
```
Current retroarch
Version: 1.17.0 (Git 076d3cc91f)
# RetroArch CM4 64bit core download location
https://github.com/christianhaitian/retroarch-cores

1
wiki/Home.md Normal file
View File

@ -0,0 +1 @@
Welcome to the uConsole wiki!

View File

@ -0,0 +1,84 @@
First we need [power on the 4G extension](https://github.com/clockworkpi/uConsole/wiki/How-to-use-the-4G-extension) on the uConsole
Then use [AT commands](https://github.com/clockworkpi/uConsole/blob/master/SIM7500_SIM7600%20Series_AT%20Command%20Manual_V3.00.pdf) to do the jobs in uConsole
We use /dev/ttyUSB3 as AT port
## Check sim card if is ready
```
echo -en "AT+CPIN?\r\n" | sudo socat - /dev/ttyUSB3,crnl
+CPIN: READY
OK
```
## Check ISP info
```
echo -en "AT+COPS?\r\n" | sudo socat - /dev/ttyUSB3,crnl
+COPS: 0,0,"SOME-ISP",7
OK
```
## Make phone call
```
echo -en "ATD123456;\r\n" | sudo socat - /dev/ttyUSB3,crnl
OK
+CLCC: 3,0,2,0,0,"123456",129
```
replace **123456** with your really target phone number
## Hang up phone call
```
echo -en "AT+CVHU=0\r\n" | sudo socat - /dev/ttyUSB3,crnl
echo -en "ATH\r\n" | sudo socat - /dev/ttyUSB3,crnl
OK
+CLCC: 3,0,6,0,0,"123456",129
OK
```
## Answer phone call
```
echo -en "ATA\r\n" | sudo socat - /dev/ttyUSB3,crnl
VOICE CALL: BEGIN
or
NO CARRIER
```
## Network state
```
echo -en "AT+CGREG?\r\n" | sudo socat - /dev/ttyUSB3,crnl
+CGREG: 2,1,E7B6,EA22BB2
OK
```
## Send text message
```
echo -e "ATZ\r" | sudo socat - /dev/ttyUSB3,crnl
sleep 1
echo -e "AT+CMGF=1\r" | sudo socat - /dev/ttyUSB3,crnl
sleep 1
echo -e "AT+CMGS=\"123456\"" | sudo socat - /dev/ttyUSB3,crnl
sleep 1
echo -e "Hello this is SMS message from shell\x1A" | sudo socat - /dev/ttyUSB3,crnl
sleep 1
echo -en "ATE0\r\n" | sudo socat - /dev/ttyUSB3,crnl
```
replace **123456** with your really target phone number
***
For more AT commands, please refer the [manual](https://github.com/clockworkpi/uConsole/blob/master/SIM7500_SIM7600%20Series_AT%20Command%20Manual_V3.00.pdf)

View File

@ -0,0 +1,235 @@
# Purpose
A more convenient way to use 4G ext on the uConsole,no setup, no nmcli ,just insert 4G card and power on 4G ext, that's it
# Power On 4G ext
we assume that you already know how to power on the 4G ext by https://github.com/clockworkpi/uConsole/wiki/How-to-use-the-4G-extension
if not ,these steps are not safe for your device
# Checking usb id
```
sudo lsusb
Bus 001 Device 009: ID 1e0e:9001 Qualcomm / Option SimTech, Incorporated
```
OR AT COMMAND
```
echo -en "AT+CUSBPIDSWITCH?\r\n" | sudo socat - /dev/ttyUSB2,crnl
```
we expecting response contains **9001**, not 9011
# Flashing part
if you got **9001** from
```
echo -en "AT+CUSBPIDSWITCH?\r\n" | sudo socat - /dev/ttyUSB2,crnl
```
then you can try to upgrade firmware to give a shot for **usb0** way of connecting 4G network
**All processess done on uConsole CM4 or A06**
## Process Summary:
Download whole package from
https://github.com/clockworkpi/uConsole/raw/master/Bin/4G/LE20B04SIM7600G22_cpi_arm64.tar.gz
and uncompress it of course
```
tar zxvf LE20B04SIM7600G22_cpi_arm64.tar.gz
cd LE20B04SIM7600G22_cpi_arm64
```
First, send the command `AT+BOOTLDR` to **/dev/ttyUSB3** to put the device into bootloader mode. At this point, the LED on the back will not light up.
```
echo -en "AT+BOOTLDR\r\n" |sudo socat - /dev/ttyUSB3,crnl
```
Next, use `sudo ./fastboot/bin/fastboot devices` to ensure that the device is detected. It should display something like `MDM9607 fastboot`.
If there is no device information, the operation must be halted.
Then, use `./flash.sh` from the compressed package to flash the firmware, which should take about **40** seconds.
here is the output of flash.sh
```
cpi@raspberrypi:~/LE20B04SIM7600G22_cpi $ ./flash.sh
sending 'aboot' (447 KB)...
OKAY [ 0.018s]
writing 'aboot'...
OKAY [ 0.563s]
finished. total time: 0.583s
sending 'rpm' (156 KB)...
OKAY [ 0.008s]
writing 'rpm'...
OKAY [ 0.064s]
finished. total time: 0.072s
sending 'sbl' (210 KB)...
OKAY [ 0.010s]
writing 'sbl'...
OKAY [ 0.089s]
finished. total time: 0.099s
sending 'tz' (514 KB)...
OKAY [ 0.020s]
writing 'tz'...
OKAY [ 0.175s]
finished. total time: 0.195s
sending 'modem' (36096 KB)...
OKAY [ 1.143s]
writing 'modem'...
OKAY [ 11.450s]
finished. total time: 12.593s
sending 'boot' (5536 KB)...
OKAY [ 0.179s]
writing 'boot'...
OKAY [ 1.744s]
finished. total time: 1.925s
sending 'system' (51072 KB)...
OKAY [ 1.616s]
writing 'system'...
OKAY [ 17.308s]
finished. total time: 18.924s
sending 'recovery' (6010 KB)...
OKAY [ 0.193s]
writing 'recovery'...
OKAY [ 1.893s]
finished. total time: 2.086s
sending 'recoveryfs' (10240 KB)...
OKAY [ 0.328s]
writing 'recoveryfs'...
OKAY [ 3.229s]
finished. total time: 3.558s
rebooting...
finished. total time: 0.005s
```
Once the flashing is completed, the device will automatically reboot, and the LED on the back will light up again.
At this point, run `sudo dmesg |tail` to check for the following output:
```
[ 1033.836166] option 1-1.3:1.2: GSM modem (1-port) converter detected
[ 1033.836636] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 1033.837179] option 1-1.3:1.3: GSM modem (1-port) converter detected
[ 1033.837597] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB1
[ 1033.838125] option 1-1.3:1.4: GSM modem (1-port) converter detected
[ 1033.838575] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2
[ 1033.839506] option 1-1.3:1.5: GSM modem (1-port) converter detected
[ 1033.840027] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB3
[ 1033.840560] option 1-1.3:1.6: GSM modem (1-port) converter detected
[ 1033.840949] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB4
```
If you see this output, it means that the firmware has been successfully flashed and the module is not bricked.
Next, modify the USB ID of the module using AT commands:
`echo -en "AT+CUSBPIDSWITCH=9011,1,1\r\n" | sudo socat - /dev/ttyUSB2,crnl`
If you receive an `OK` response, the device will automatically reboot. Wait for the LED to flash again.
Finally, run `sudo dmesg | tail` to check for the following output:
```
[ 1033.836166] option 1-1.3:1.2: GSM modem (1-port) converter detected
[ 1033.836636] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 1033.837179] option 1-1.3:1.3: GSM modem (1-port) converter detected
[ 1033.837597] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB1
[ 1033.838125] option 1-1.3:1.4: GSM modem (1-port) converter detected
[ 1033.838575] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2
[ 1033.839506] option 1-1.3:1.5: GSM modem (1-port) converter detected
[ 1033.840027] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB3
[ 1033.840560] option 1-1.3:1.6: GSM modem (1-port) converter detected
[ 1033.840949] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB4
[ 1033.936224] usbcore: registered new interface driver cdc_ether
[ 1033.956009] rndis_host 1-1.3:1.0 usb0: register 'rndis_host' at usb-fe980000.usb-1.3, RNDIS device, 8e:32:ae:30:8f:03
[ 1033.956181] usbcore: registered new interface driver rndis_host
[ 1033.966622] usbcore: registered new interface driver rndis_wlan
```
now you can see 9011 in lsusb
```
cpi@raspberrypi:~/LE20B04SIM7600G22_cpi $ sudo lsusb
Bus 001 Device 008: ID 1e0e:9011 Qualcomm / Option SimTech, Incorporated
```
and `sudo ifconfig usb0`
So, the appearance of usb0 indicates success.
In fact, at this point, if the SIM card is inserted correctly, the 4G network should already be connected.
to test if the 4G connection is ok by
```
cpi@raspberrypi:~/LE20B04SIM7600G22_cpi $ ping -I usb0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from ***.***.***.** usb0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=109 time=331 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=109 time=98.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=109 time=84.3 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=109 time=89.0 ms
```
# Precautions
The above-mentioned flashing operation requires your familiarity with Linux and firmware flashing. Please do not attempt it without sufficient experience, as we will not be held responsible for any consequences. Thank you for your understanding.
once you flashed the new firmware, there is no going back
even if you switch id from 9011 to 9001 ,mmcli may not able to see the 4G modem any more.
Therefore, there are risks involved in flashing the 4g ext, and it is necessary for you to have a certain understanding of these background information. During the testing process, it is also not possible for me to test whether all SIM cards worldwide can easily connect to the internet through **usb0**.
# Access Point Name (APN)
Generally, **usb0** will automatically connect, but for configuring the Access Point Name (APN),
see:
https://techship.com/faq/how-to-automated-connection-establishment-with-sim7600-series-modules-when-using-rndis-usb-mode/
# Useful AT commands
* check firmware version
```
echo -en "AT+GMR\r\n" | sudo socat - /dev/ttyUSB2,crnl
+GMR: LE20B04SIM7600G22
OK
```
* check sim card status
```
echo -en "AT+cpin?\r\n" |sudo socat - /dev/ttyUSB2,crnl
+CPIN: READY
OK
```
* check signal quality
```
echo -en "AT+CSQ\r\n" |sudo socat - /dev/ttyUSB2,crnl
+CSQ: 20,99
OK
```
* get imei
```
echo -en "AT+CGSN\r\n" |sudo socat - /dev/ttyUSB2,crnl
86263605126xxxx
OK
```
```
echo -en "AT+CIMI\r\n" |sudo socat - /dev/ttyUSB2,crnl
46001341620xxxx
OK
```

View File

@ -0,0 +1,130 @@
4G extension on the uConsole is power down by default
## First we need to power on the 4G extension
### CM4
run `enable_4g_cm4.sh` or `uconsole-4g-cm4 enable`, depends on the version of your os image, both can do the same job
Please wait for it to complete, which may take about 20 seconds. Please be patient and try not press ctrl+c.
next is **VERY IMPORTANT**, to check the version of your 4G extension by AT commands:
```
echo -en "AT+CUSBPIDSWITCH?\r\n" | sudo socat - /dev/ttyUSB2,crnl
```
we expecting to see **9001**
if you are other module number ,eg :9011
you don't need any following steps
just make sure the SIM card inserted correctlly,and use **sudo ifconfig** to see if there is a **usb0**
if there is a usb0,then all is set
normally you will have ipv4 and ipv6 address,now you can use 4G card to view internet
#### 9001 part
use `mmcli -L` to see if there is a modem like
```
/org/freedesktop/ModemManager1/Modem/0 [QUALCOMM INCORPORATED] SIMCOM_SIM7600G-H
```
and if unpack your back shell , you will see a green LED light is flashing on 4G ext
### A06 and R01
run `enable_4g.sh` or `uconsole-4g enable` depends on the version of your os image, both can do the same job
Please wait for it to complete, which may take about 20 seconds. Please be patient and try not press ctrl+c.
next is **VERY IMPORTANT**, to check the version of your 4G extension by AT commands:
```
echo -en "AT+CUSBPIDSWITCH?\r\n" | sudo socat - /dev/ttyUSB2,crnl
```
we expecting to see **9001**
if you are other module number ,eg :9011
you don't need any following steps
just make sure the SIM card inserted correctlly,and use **sudo ifconfig** to see if there is a **usb0**
if there is a usb0,then all is set
normally you will have ipv4 and ipv6 address,now you can use 4G card to view internet
#### 9001 part
use `mmcli -L` to see if there is a modem like
```
/org/freedesktop/ModemManager1/Modem/0 [QUALCOMM INCORPORATED] SIMCOM_SIM7600G-H
```
and if unpack your back shell , you will see a green LED light is flashing on 4G ext
## Connect to 4G network
for this purpose,we need `nmcli` to create a gsm connection first
### find out the primary port
```
mmcli -m any | grep "primary port"
```
you will get like `cdc-wdm0` or `ttyUSB2` , if you got `cdc-wdm0`, we suggest blacklisting some kernel modules by
```
sudo bash -c 'cat << EOF > /etc/modprobe.d/blacklist-qmi.conf
blacklist qmi_wwan
blacklist cdc_wdm
EOF'
```
`ttyUSB2` is what we want,but **cdc-wdm0** is still worth to try if you knew it well
### Create 4g net connection and bring it up
```
sudo nmcli c add type gsm ifname ttyUSB2 con-name 4gnet apn [yourapn] gsm.username [gsmusername] gsm.password [gsmpassword]
```
```
sudo nmcli c up 4gnet
```
then if everything goes right, you will see **ppp0** in `sudo ifconfig` , which means you got an PPPoE connection and an IP address
The connectivity of 4G may vary in different countries around the world, so please make appropriate adjustments based on the situation of your ISP operator, which may require some Linux-related skills.
## GPS
We use AT commands to get GPS data
### start gps
```
cpi@raspberrypi:~ $ echo -en "AT+CGPS=1\r\n" | sudo socat - /dev/ttyUSB3,crnl
OK
```
### wait about one minute depend on the gps signal,get gps data
```
cpi@raspberrypi:~ $ echo -en "AT+CGPSINFO\r\n" | sudo socat - /dev/ttyUSB3,crnl
+CGPSINFO: 3036.995500,N,12016.782856,E,200224,082124.0,40.5,0.0,
OK
```
### close gps
```
cpi@raspberrypi:~ $ echo -en "AT+CGPS=0\r\n" | sudo socat - /dev/ttyUSB3,crnl
```
make sure the **GPS antenna** is connected to the **GNSS** port on 4G extension

View File

@ -0,0 +1,110 @@
Based on 26f52bfde573479960d8696f407d19b9 http://dl.clockworkpi.com/DevTerm_A06_v0.2h.img.bz2
Since uconsole and devterm are using the same main board
Just need to update a new kernel for uconsole LCD screen
## Kernel
https://github.com/clockworkpi/uConsole/tree/master/Code/patch/a06/20230630
Combine linux-dtb-current-rockchip64_23.02.0-trunk_arm64.deb and linux-image-current-rockchip64_23.02.0-trunk_arm64.deb to a new deb file
One of the more complicated tasks is merging preinst, postinst, postrm, and prerm files.
```
cat linux-image-current-rockchip64/preinst linux-dtb-current-rockchip64/preinst > preinst
cat linux-image-current-rockchip64/postinst linux-dtb-current-rockchip64/postinst > postinst
cat linux-image-current-rockchip64/postrm > postrm
cat linux-image-current-rockchip64/prerm > prerm
```
## Expand img size
```
dd if=/dev/zero bs=1MiB of=DevTerm_A06_v0.2h.img conv=notrunc oflag=append count=3000
sudo losetup -f --show -P DevTerm_A06_v0.2h.img #assume got /dev/loop0
sudo gparted /dev/loop0 #resize it,fullfill empty space with last partition by mouse drag
sudo losetup -D /dev/loop0
```
## Chroot
Chroot into DevTerm_A06_v0.2h.img by
```
sudo mkdir -p /mnt/p1
sudo losetup --show -f -P DevTerm_A06_v0.2h.img #assume loop0
sudo mount /dev/loop0p1 /mnt/p1
cd /mnt/p1
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
#sudo mv etc/ld.so.preload etc/ld_so_preload
sudo chroot .
```
## In chroot
```
sudo apt update
#update kernel
sudo apt install -y uconsole-kernel-current-cpi-a06
#install additional games/emulators
sudo apt install -y devterm-tic80-cpi uconsole-love2d retroarch dosbox devterm-cavestory-cpi-cm4 uconsole-liko12 uconsole-lowresnx uconsole-dosbox-staging pppoe uconsole_4g_utils
#for 4G extension
sudo bash -c 'cat << EOF > /etc/modprobe.d/blacklist-qmi.conf
blacklist qmi_wwan
blacklist cdc_wdm
EOF'
# uconsole does not have thermal printer
sudo apt remove devterm-thermal-printer # uconsole does not have thermal printer
#pre configs
cd /usr/local/bin/
git clone -b uconsole-a06 https://github.com/cuu/skel.git
cp -rf skel/.config /home/cpi/
cp -rf skel/.local /home/cpi
cp -rf skel/.dosbox /home/cpi
cp -rf skel/.opentyrian /home/cpi
cp -rf skel/etc/sudoers.d/cpi /etc/sudoers.d/
chown -R cpi:cpi /home/cpi
#remove old configs for screen rotation,since new uconsole a06 kernel did screen rotation
* nano /boot/armbianEnv.txt ,remove "fbcon=rotate:1"
* rm -rf /etc/X11/Xsession.d/90custom_xrandr
* rm -rf /etc/lightdm/setup.sh
* rm -rf /etc/lightdm/lightdm.conf.d/13-rotate-dsi.conf
exit #quit chroot
```
## Clean chroot
do it everytime when you are done with chroot enviroment
```
cd -
sudo umount /mnt/p1/dev/pts
sudo umount /mnt/p1/dev
sudo umount /mnt/p1/proc
sudo umount /mnt/p1/sys
##clear bash
sudo rm -rf /mnt/p1/root/.bash_history
sudo umount /mnt/p1
sudo losetup -D /dev/loop0
```
All uconsole image can be found at : https://github.com/clockworkpi/uConsole/tree/master/images
That'it , happy hacking

View File

@ -0,0 +1,111 @@
Based on 4d990ec702d0b6383f6e43bbeb3e3274 http://dl.clockworkpi.com/DevTerm_CM4_v0.1a_64bit.img.bz2
Since the uConsole and devterm are using the same main board
Just need to update a new kernel for the uConsole LCD screen
original create os image from scratch is here:
https://github.com/clockworkpi/DevTerm/wiki/Create-DevTerm-CM4-OS-image-from-scratch
## Kernel
https://github.com/clockworkpi/uConsole/tree/master/Code/patch/cm4/20230630
Create a deb file of uconsole_kernel_cm4-rpi based on kernel compiled output files
Another important thing to note is the correct configuration file, "config.txt".
```
disable_overscan=1
dtparam=audio=on
[pi4]
max_framebuffers=2
[all]
ignore_lcd=1
dtoverlay=dwc2,dr_mode=host
dtoverlay=vc4-kms-v3d-pi4,cma-384
dtoverlay=devterm-pmu
dtoverlay=devterm-panel-uc
dtoverlay=devterm-misc
dtoverlay=audremap,pins_12_13
dtparam=spi=on
gpio=10=ip,np
```
especially the line **dtoverlay=devterm-panel-uc**
## Chroot
Chroot into DevTerm_CM4_v0.1a_64bit.img
by
```
sudo mkdir -p /mnt/p1
sudo losetup --show -f -P DevTerm_CM4_v0.1a_64bit.img #assume loop0
sudo mount /dev/loop0p2 /mnt/p1
sudo mount /dev/loop0p1 /mnt/p1/boot
cd /mnt/p1
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
#sudo mv etc/ld.so.preload etc/ld_so_preload
sudo chroot .
```
## In chroot
```
sudo apt update
#update kernel
sudo apt install -y uconsole_kernel_cm4-rpi
#install additional games/emulators
sudo apt install -y devterm-tic80-cpi uconsole-love2d retroarch dosbox devterm-cavestory-cpi-cm4 uconsole-liko12 uconsole-lowresnx uconsole-dosbox-staging pppoe uconsole-4g-util-cm4
#for 4G extension
sudo bash -c 'cat << EOF > /etc/modprobe.d/blacklist-qmi.conf
blacklist qmi_wwan
blacklist cdc_wdm
EOF'
# uconsole does not have thermal printer
sudo apt remove devterm-thermal-printer devterm-thermal-printer-cm4 # uconsole does not have thermal printer
#pre configs
cd /usr/local/bin/
git clone -b uconsole-cm4 https://github.com/cuu/skel.git
cp -rf skel/etc/xdg/autostart/first-touch.desktop /etc/xdg/autostart/
cp -rf skel/usr/local/bin/chgpas.sh /usr/local/bin/
#remove old configs for screen rotation,since new uconsole cm4 kernel did screen rotation
nano /boot/cmdline.txt ,remove "fbcon=rotate:1"
rm -rf /etc/X11/Xsession.d/90custom_xrandr
rm -rf /etc/lightdm/setup.sh
edit /etc/lightdm/lightdm.conf
comment out or delete line :
"greeter-setup-script=/etc/lightdm/setup.sh"
exit #quit chroot
```
## Clean chroot
do it everytime when you are done with chroot enviroment
```
cd -
sudo umount /mnt/p1/dev/pts
sudo umount /mnt/p1/dev
sudo umount /mnt/p1/proc
sudo umount /mnt/p1/sys
##clear bash
sudo rm -rf /mnt/p1/root/.bash_history
sudo umount /mnt/p1/boot
sudo umount /mnt/p1
sudo losetup -D /dev/loop0
```
All the uConsole image can be found at : https://github.com/clockworkpi/uConsole/tree/master/images
That's it , happy hacking

View File

@ -0,0 +1,92 @@
# Kali linux image for uConsole cm4
we use kali-linux-2024.1-raspberry-pi-arm64.img
and some original uConsole cm4 debs to make the image for uConsole CM4
## Here is the process:
```
sudo losetup -f --show -P kali-linux-2024.1-raspberry-pi-arm64.img
#assume we got /dev/loop1
sudo mount /dev/loop1p2 /mnt/p1/
sudo mount /dev/loop1p1 /mnt/p1/boot/
#mount chroot env
cd /mnt/p1
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
#sudo chroot .
# remove kali kernel and headers (5.15.44)
sudo chroot /mnt/p1 /bin/bash -c 'sudo apt remove kalipi-kernel kalipi-kernel-headers -y'
#add cpi apt source list
sudo chroot /mnt/p1/ /bin/bash -c 'wget -q -O- https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/clockworkpi.gpg'
sudo chroot /mnt/p1/ /bin/bash -c 'echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee /etc/apt/sources.list.d/clockworkpi.list'
sudo chroot /mnt/p1/ /bin/bash -c 'sudo apt update'
#install the uconsole cm4 kernel
sudo chroot /mnt/p1/ /bin/bash -c 'sudo apt install -y uconsole-kernel-cm4-rpi'
# rotate lightdm
cat << EOF | sudo chroot /mnt/p1
cat <<EOL >/etc/lightdm/setup.sh
#!/bin/bash
xrandr --output DSI-1 --rotate right
exit 0
EOL
EOF
sudo chroot /mnt/p1/ /bin/bash -c 'sudo chmod +x /etc/lightdm/setup.sh'
sudo chroot /mnt/p1/ /bin/bash -c "sed -i 's/^#greeter-setup-script=.*/greeter-setup-script=\/etc\/lightdm\/setup.sh/' /etc/lightdm/lightdm.conf"
#install 4G stuff !!
sudo chroot /mnt/p1 /bin/bash -c 'sudo apt install -y pppoe uconsole-4g-util-cm4'
#for 4G extension !!
cat << EOF | sudo chroot /mnt/p1
cat << EOL > /etc/modprobe.d/blacklist-qmi.conf
blacklist qmi_wwan
blacklist cdc_wdm
EOL
EOF
# forbidden kali kernel package
cat << EOF | sudo chroot /mnt/p1
cat <<EOL > /etc/apt/preferences.d/kalipi-kernel
Package: kalipi-kernel
Pin: release *
Pin-Priority: -1
EOL
EOF
cat << EOF | sudo chroot /mnt/p1
cat <<EOL > /etc/apt/preferences.d/kalipi-kernel-headers
Package: kalipi-kernel-headers
Pin: release *
Pin-Priority: -1
EOL
EOF
#clear chroot env
cd -
sudo umount /mnt/p1/dev/pts
sudo umount /mnt/p1/dev
sudo umount /mnt/p1/proc
sudo umount /mnt/p1/sys
##clear bash
sudo rm -rf /mnt/p1/root/.bash_history
sudo umount /mnt/p1/boot
sudo umount /mnt/p1
sudo losetup -D /dev/loop1
```
Now we can dd the img into a SD card bigger than 8GB
`sudo dd if=kali-linux-2024.1-raspberry-pi-arm64.img of=/dev/sdcard bs=1M status=progress`