Updated How uConsole CM4 OS image made (markdown)

GNU 2024-12-13 23:31:04 -08:00
parent f67675f3b7
commit e091d303e6

@ -1,24 +1,38 @@
Based on 4d990ec702d0b6383f6e43bbeb3e3274 http://dl.clockworkpi.com/DevTerm_CM4_v0.1a_64bit.img.bz2 # How uConsole CM4 OS Image Is Made
Since the uConsole and devterm are using the same main board 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.
Just need to update a new kernel for the uConsole LCD screen ---
original create os image from scratch is here: ## **Base OS Image**
https://github.com/clockworkpi/DevTerm/wiki/Create-DevTerm-CM4-OS-image-from-scratch The base OS image used is the DevTerm CM4 image:
## Kernel - Download the base image:
[DevTerm_CM4_v0.1a_64bit.img.bz2](http://dl.clockworkpi.com/DevTerm_CM4_v0.1a_64bit.img.bz2)
md5sum: 4d990ec702d0b6383f6e43bbeb3e3274
https://github.com/clockworkpi/uConsole/tree/master/Code/patch/cm4/20230630 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).
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". ## **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 disable_overscan=1
dtparam=audio=on dtparam=audio=on
[pi4] [pi4]
max_framebuffers=2 max_framebuffers=2
@ -34,78 +48,119 @@ dtoverlay=audremap,pins_12_13
dtparam=spi=on dtparam=spi=on
gpio=10=ip,np gpio=10=ip,np
``` ```
especially the line **dtoverlay=devterm-panel-uc**
## Chroot **Key line:**
Chroot into DevTerm_CM4_v0.1a_64bit.img `dtoverlay=devterm-panel-uc` (This sets the panel configuration specific to the uConsole.)
by
``` ---
## **Chroot Environment**
To modify the image in a chroot environment:
1. Mount the image:
```bash
sudo mkdir -p /mnt/p1 sudo mkdir -p /mnt/p1
sudo losetup --show -f -P DevTerm_CM4_v0.1a_64bit.img #assume loop0 sudo losetup --show -f -P DevTerm_CM4_v0.1a_64bit.img # Assume loop0
sudo mount /dev/loop0p2 /mnt/p1 sudo mount /dev/loop0p2 /mnt/p1
sudo mount /dev/loop0p1 /mnt/p1/boot sudo mount /dev/loop0p1 /mnt/p1/boot
```
2. Set up the chroot environment:
```bash
cd /mnt/p1 cd /mnt/p1
sudo mount --bind /dev dev/ sudo mount --bind /dev dev/
sudo mount --bind /sys sys/ sudo mount --bind /sys sys/
sudo mount --bind /proc proc/ sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts sudo mount --bind /dev/pts dev/pts
#sudo mv etc/ld.so.preload etc/ld_so_preload
sudo chroot . sudo chroot .
``` ```
## In chroot 3. Inside the chroot environment:
``` - Update the system and kernel:
```bash
sudo apt update sudo apt update
#update kernel
sudo apt install -y uconsole-kernel-cm4-rpi 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 - 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 sudo bash -c 'cat << EOF > /etc/modprobe.d/blacklist-qmi.conf
blacklist qmi_wwan blacklist qmi_wwan
blacklist cdc_wdm blacklist cdc_wdm
EOF' EOF'
```
# uconsole does not have thermal printer - Remove unnecessary software (e.g., thermal printer utilities, as uConsole does not include a thermal printer):
sudo apt remove devterm-thermal-printer devterm-thermal-printer-cm4 # uconsole does not have thermal printer
#pre configs ```bash
sudo apt remove devterm-thermal-printer devterm-thermal-printer-cm4
```
- Perform pre-configurations:
```bash
cd /usr/local/bin/ cd /usr/local/bin/
git clone -b uconsole-cm4 https://github.com/cuu/skel.git 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/etc/xdg/autostart/first-touch.desktop /etc/xdg/autostart/
cp -rf skel/usr/local/bin/chgpas.sh /usr/local/bin/ 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 - Clean up old screen rotation settings (the new kernel already handles screen rotation):
nano /boot/cmdline.txt ,remove "fbcon=rotate:1" ```bash
nano /boot/cmdline.txt # Remove "fbcon=rotate:1"
rm -rf /etc/X11/Xsession.d/90custom_xrandr rm -rf /etc/X11/Xsession.d/90custom_xrandr
rm -rf /etc/lightdm/setup.sh rm -rf /etc/lightdm/setup.sh
edit /etc/lightdm/lightdm.conf nano /etc/lightdm/lightdm.conf # Comment out or delete the line:
comment out or delete line : # greeter-setup-script=/etc/lightdm/setup.sh
"greeter-setup-script=/etc/lightdm/setup.sh"
exit #quit chroot
``` ```
## Clean chroot 4. Exit the chroot environment:
do it everytime when you are done with chroot enviroment
```bash
exit
``` ```
---
## **Clean Chroot Environment**
After finishing work in the chroot environment, clean up:
```bash
cd - cd -
sudo umount /mnt/p1/dev/pts sudo umount /mnt/p1/dev/pts
sudo umount /mnt/p1/dev sudo umount /mnt/p1/dev
sudo umount /mnt/p1/proc sudo umount /mnt/p1/proc
sudo umount /mnt/p1/sys sudo umount /mnt/p1/sys
##clear bash
# Clear bash history
sudo rm -rf /mnt/p1/root/.bash_history sudo rm -rf /mnt/p1/root/.bash_history
sudo umount /mnt/p1/boot sudo umount /mnt/p1/boot
sudo umount /mnt/p1 sudo umount /mnt/p1
sudo losetup -D /dev/loop0 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 ---
## **Final Notes**
- All official uConsole OS images can be found here:
[uConsole Images Repository](https://github.com/clockworkpi/uConsole/tree/master/images)
- Happy hacking!