[deepin exploration] Raspberry Pi running deepin v23
Tofloor
poster avatar
yanjuner
Super Moderator
2024-04-11 15:59
Author

introduce

The Raspberry Pi runs the deepin system.

Build kernel

The kernel can be copied from the boot directory of the official raspberrypi/firmware warehouse.

Install tools, select cross compilation here

sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev

Install 64-bit toolchain for 64-bit kernel

sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev

Clone code

git clone --depth=1 https://github.com/raspberrypi/linux

Run the following commands according to your Raspberry Pi model to prepare the default configuration.

Raspberry Pi 4B is used here

cd linux
KERNEL=kernel8
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig

Build with configuration, for all 64-bit versions

make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image dtbs modules

Partition

Insert the SD into the computer using a card reader and use to lsblkidentify the device. The subsequent operations are the same as inserting an SD card.

Here dd disk files are used as SD cards.

dd if=/dev/zero of=deepin-raspberrypi.img bs=1M count=16384

If it is an SD card, format it and run lsblk to check the specific device.

If the partition is mounted and needs to be unmounted sudo umount /media/xxx, use fdisk to delete the existing partition. The following is to partition the disk. The same is true for the SD card.

sudo fdisk deepin-raspberrypi.img << EOF
n
p
1

+300M
t
c
n
p
2


w
EOF

mount

DEV=$(sudo losetup --partscan --find --show deepin-raspberrypi.img)

sudo mkfs.fat -F32 "${DEV}p1"
sudo mkfs.ext4 "${DEV}p2" # 根分区 (/)

Copy root file system and boot

mkdir /mnt/rootfs
ROOTFS="/mnt/rootfs"
sudo mount "${DEV}p2" $ROOTFS

# 根文件系统
./build-rootfs.sh
sudo mount "${DEV}p1" $ROOTFS/boot

# 在物理设备上需要添加 cmdline.txt 定义 Linux内核启动时的命令行参数

PTUUID=$(sudo blkid /dev/loop0 | awk -F'PTUUID="' '{print $2}' | awk -F'"' '{print $1}')
echo "console=serial0,115200 console=tty1 root=PARTUUID=$PTUUID-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh" | sudo tee $ROOTFS/boot/cmdline.txt

# 拷贝引导加载程序/GPU 固件等, 从 https://github.com/raspberrypi/firmware/tree/master/boot 官方仓库中拷贝,另外放入了 cmdline.txt 和 config.txt 配置

sudo cp -r firmware/* $ROOTFS/boot

extra package

# deepin 源里目前没有 raspi-config 这个包,需要另外下载
sudo mount --bind /dev $ROOTFS/dev
sudo mount -t proc none $ROOTFS/proc
sudo mount -t sysfs none $ROOTFS/sys

sudo chroot $ROOTFS bash

# 进入根文件系统
curl http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20240313_all.deb -o raspi-config.deb
apt install ./raspi-config.deb
rm ./raspi-config.deb

# 退出系统
exit

Edit partition table

PTUUID=$(sudo blkid /dev/loop0 | awk -F'PTUUID="' '{print $2}' | awk -F'"' '{print $1}')
sudo tee $ROOTFS/etc/fstab << EOF
proc            /proc           proc    defaults          0       0
PARTUUID=$PTUUID-01  /boot           vfat    defaults          0       2
PARTUUID=$PTUUID-02  /               ext4    defaults,noatime  0       1
EOF

start up

Try to start using qemu

The kernel and device tree used below were compiled by me. You can also directly copy kernel.img and bcm2710-rpi-3-b.dtb in the firmware.

qemu-system-aarch64 -machine type=raspi3b \
	-m 1G  -dtb ~/code/raspberrypi/linux/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb \
	-kernel ~/code/raspberrypi/linux/arch/arm64/boot/Image \
	-drive id=hd-root,format=raw,file=deepin-raspberrypi.img \
	-append "rw earlycon=pl011,0x3f201000 console=ttyAMA0 console=ttyS0,115200 loglevel=8 root=/dev/mmcblk0p2 fsck.repair=yes net.ifnames=0 rootwait memtest=1 dwc_otg.fiq_fsm_enable=0" \
	-serial stdio \
	-netdev user,id=net0,net=10.0.2.0/24,hostfwd=tcp::8022-:22 \
	-usb -device usb-kbd -device usb-tablet -device usb-net,netdev=net0

Boot from SD card

Directly insert the SD into the Raspberry Pi, power it on, and insert it into the display, no additional operations are required.

pc1.png

Install desktop environment

The stable source of arm may lack some packages. First add the ci for building.

sudo vim /etc/apt/sources.list

deb [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/Develop:/main/standard/ ./
deb-src [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/Develop:/main/standard/ ./
deb [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/Develop:/community/deepin_develop/ ./
deb-src [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/Develop:/community/deepin_develop/ ./
deb [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/Develop:/dde/deepin_develop/ ./
deb-src [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/Develop:/dde/deepin_develop/ ./

sudo apt update && sudo apt upgrade

sudo apt install deepin-desktop-environment-base
sudo apt install deepin-desktop-environment-cli
sudo apt install deepin-desktop-environment-core
sudo apt install deepin-desktop-environment-extras
sudo apt install deepin-desktop-environment-ll

After the installation is complete, you can choose to comment out the ci source to avoid dependency conflicts.

desktop1.png

desktop2.png

Finished with flowers.

reference

QEMU Simulation Raspberry Pi 1 and 3B-Nanny Level Tutorial

raspberrypi document0ation

project

deepin-raspberrypi

Install the desktop environment and add it later

Reply Favorite View the author
All Replies
m***[email protected]
deepin
2024-04-17 17:14
#1

Hi!

Could you please share the SD Card image file? It could be convenient to be shared among community, simple to flash on SD Card...

Reply View the author
空木蓮華
deepin
2024-04-18 09:21
#2
m***[email protected]

Hi!

Could you please share the SD Card image file? It could be convenient to be shared among community, simple to flash on SD Card...

Of course, this is the image link: https://github.com/chenchongbiao/deepin-raspberrypi/releases/download/v1.0.0/deepin-raspberrypi.zip , excluding desktop environment.

Reply View the author