restore wiki folder

This commit is contained in:
cuu 2024-12-15 17:37:02 +08:00
parent ad88734be0
commit 790ce71478
9 changed files with 1002 additions and 0 deletions

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

47
wiki/Home.md Normal file
View File

@ -0,0 +1,47 @@
# Welcome to the uConsole Wiki!
uConsole, developed by ClockworkPi, is a powerful, modular, and portable device designed for developers, makers, and tech enthusiasts. This Wiki serves as a comprehensive documentation resource, providing guides for hardware extensions, OS image creation, and various functionalities. Whether you're new to uConsole or looking to explore its advanced features, this Wiki is your go-to resource.
## Quick Navigation
Below is the list of available Wiki pages. Click on the links to explore detailed guides and information:
* [Compile RetroArch for CM4](https://github.com/clockworkpi/uConsole/wiki/Compile-retroarch-for-cm4)
Learn how to compile and run the RetroArch emulator on the CM4 module of uConsole.
* [How to Make Phone Calls and Send SMS with the 4G Extension](https://github.com/clockworkpi/uConsole/wiki/How-to-make-phone-call---send-sms-with-4G-extension)
A guide on how to use the 4G extension module for making phone calls and sending SMS.
* [How to Upgrade 4G Extension Firmware](https://github.com/clockworkpi/uConsole/wiki/How-to-upgrade-4G-extension-firmware)
Learn how to update the firmware of the 4G extension module to access the latest features and fixes.
* [How to Use the Keyboard UART Port to Flash Firmware](https://github.com/clockworkpi/uConsole/wiki/How-to-use-keyboard-UART-port-to-flash-firmware)
Detailed instructions on how to flash firmware using the keyboard's UART port.
* [How to Use the 4G Extension ](https://github.com/clockworkpi/uConsole/wiki/How-to-use-the-4G-extension)
A guide to help you operate and configure the 4G extension module.
* [How the uConsole A06 OS Image Is Made](https://github.com/clockworkpi/uConsole/wiki/How-uConsole-A06-OS-image-made)
Learn how to create a custom OS image for the A06 module of uConsole.
* [How the uConsole CM4 OS Image Is Made](https://github.com/clockworkpi/uConsole/wiki/How-uConsole-CM4-OS-image-made)
Instructions for generating OS images for the CM4 module of uConsole.
* [Kali Linux Image for uConsole CM4](https://github.com/clockworkpi/uConsole/wiki/Kali-linux-image-for-uConsole-cm4)
Information on running Kali Linux on the CM4 module of uConsole.
## Edit
### Directly on the GitHub Website
If you have the necessary permissions, go to the Wiki page of the target repository.
Click the "Edit" button (or the pencil icon on the page).
Edit the content of the Wiki page directly in the web interface using Markdown format.
Once youre done, click the "Save Page" button to save your changes.
### Pull Request
Just clone https://github.com/clockworkpi/uConsole, and add markdown files to the **_wiki** folder
Then Send Pull Request , once got merged, wiki will be shown at https://github.com/clockworkpi/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,240 @@
# Precautions
The following-mentioned flashing operation requires your familiarity with Linux and firmware flashing.
**Please do not attempt to try it without sufficient experience!**
**Please do not attempt to try it without sufficient experience!**
**Please do not attempt to try 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**.
# 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
```
# 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,55 @@
**All operations are under desktop linux**
On uConsole keyboard back,there is a **UART** port which can be used with `stm32flash` to flash keyboard stock firmware
Especially when your keyboard met problem
here is the process:
* put the switch 1 ON
* connect uart with a **fpc 6p connector 0.5mm** to a serial-usb converter
* use stm32flash to flash bin file
* put the switch 1 OFF
## Whole connection view
![uconsole_kbd_stm32flash](https://github.com/user-attachments/assets/66a0028a-b6c1-4af2-92e7-91c6179fe272)
## UART ports
![sch](https://github.com/user-attachments/assets/06d88726-af96-4573-ba60-74b870bb07cf)
3 is TX(PA9)
4 is RX(PA10)
## 1st pin of UART on board
![7130803](https://github.com/user-attachments/assets/eeed0c0a-ea86-4496-b931-dcc074835eca)
## Flashing command
```
$ sudo stm32flash -w uconsole.kbd.0.4_48mhz.bin -v -S 0x08000000 /dev/ttyUSB0
```
You can get uconsole.kbd.0.4_48mhz.bin from https://github.com/clockworkpi/uConsole/tree/master/Bin
## Normal flashing output
```
stm32flash 0.5
http://stm32flash.sourceforge.net/
Using Parser : Raw BINARY
Interface serial_posix: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (STM32F10xxx Medium-density)
- RAM : Up to 20KiB (512b reserved by bootloader)
- Flash : Up to 128KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote and verified address 0x08010000 (100.00%) Done.
```

View File

@ -0,0 +1,136 @@
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
```
if not ,try
```
sudo systemctl restart ModemManager
```
then
use `mmcli -L` to check again, some modems will require ModemManager to restart to see the device
If unpack your back shell , you also will see a green LED light is flashing on 4G ext once got power on
### 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,166 @@
# How uConsole CM4 OS Image Is Made
This guide explains how to create an OS image for the uConsole CM4 module. Since the uConsole and DevTerm share the same mainboard, the process involves adapting the DevTerm CM4 OS image with updates specific to the uConsole, such as a new kernel for its LCD screen.
---
## **Base OS Image**
The base OS image used is the DevTerm CM4 image:
- Download the base image:
[DevTerm_CM4_v0.1a_64bit.img.bz2](http://dl.clockworkpi.com/DevTerm_CM4_v0.1a_64bit.img.bz2)
md5sum: 4d990ec702d0b6383f6e43bbeb3e3274
For detailed instructions on creating the base image from scratch, refer to:
[Create DevTerm CM4 OS Image from Scratch](https://github.com/clockworkpi/DevTerm/wiki/Create-DevTerm-CM4-OS-image-from-scratch).
---
## **Kernel Update**
To update the kernel for the uConsole CM4:
1. Use the kernel files located here:
[uConsole Kernel for CM4](https://github.com/clockworkpi/uConsole/tree/master/Code/patch/cm4/20230630)
2. Create a `.deb` package for the kernel:
`uconsole_kernel_cm4-rpi` is built from the compiled output files.
3. Ensure the correct configuration in the `config.txt` file. Below is an example configuration:
```text
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
```
**Key line:**
`dtoverlay=devterm-panel-uc` (This sets the panel configuration specific to the uConsole.)
---
## **Chroot Environment**
To modify the image in a chroot environment:
1. Mount the image:
```bash
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
```
2. Set up the chroot environment:
```bash
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 .
```
3. Inside the chroot environment:
- Update the system and kernel:
```bash
sudo apt update
sudo apt install -y uconsole-kernel-cm4-rpi
```
- Install additional software (games, emulators, and utilities):
```bash
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
```
- Configure the 4G extension module (optional):
```bash
sudo bash -c 'cat << EOF > /etc/modprobe.d/blacklist-qmi.conf
blacklist qmi_wwan
blacklist cdc_wdm
EOF'
```
- Remove unnecessary software (e.g., thermal printer utilities, as uConsole does not include a thermal printer):
```bash
sudo apt remove devterm-thermal-printer devterm-thermal-printer-cm4
```
- Perform pre-configurations:
```bash
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/
```
- Clean up old screen rotation settings (the new kernel already handles screen rotation):
```bash
nano /boot/cmdline.txt # Remove "fbcon=rotate:1"
rm -rf /etc/X11/Xsession.d/90custom_xrandr
rm -rf /etc/lightdm/setup.sh
nano /etc/lightdm/lightdm.conf # Comment out or delete the line:
# greeter-setup-script=/etc/lightdm/setup.sh
```
4. Exit the chroot environment:
```bash
exit
```
---
## **Clean Chroot Environment**
After finishing work in the chroot environment, clean up:
```bash
cd -
sudo umount /mnt/p1/dev/pts
sudo umount /mnt/p1/dev
sudo umount /mnt/p1/proc
sudo umount /mnt/p1/sys
# Clear bash history
sudo rm -rf /mnt/p1/root/.bash_history
sudo umount /mnt/p1/boot
sudo umount /mnt/p1
sudo losetup -D /dev/loop0
```
---
## **Final Notes**
- All official uConsole OS images can be found here:
[uConsole Images Repository](https://github.com/clockworkpi/uConsole/tree/master/images)
- 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`