BPI-CM4 compile BSP and Lighting it

I got my BPI-CM4 yesterday, so I manage to light it today :rofl: . Bootloader and kernel are compiled from BSP, installed to microSD with preinstalled M2S system image. Because cpu of M2S is Amlogic A311D, the same as CM4, and wiki of CM4 is also linked to M2S.

Running CM4:
running1

Preparation

Write Bananapi M2S system image to microSD,my version:

2022-06-20-ubuntu-20.04-mate-desktop-bpi-m2s-aarch64-sd-emmc.img

Besides, my compiling computer is Ubuntu 18.04

Compilation

Enviroment setup

  1. Download BSP from github

    $ git clone https://github.com/BPI-SINOVOIP/BPI-M2S-BSP
    $ git submodule update --init --recursive

  2. Compile CM4 BSP as follow

    $ ./build.sh bpi-cm4
    cm4_build_all
    Enter 1 to start building

  3. when finished, compiled files are in ./SD
    cm4_SD
    Here, bpi-tools.gz is generated by following steps.

Install to SD card

  1. Edit ./scripts/mk_install_sd.sh (Optional)
    cm4_mk_ins
    Alter: copy shells in bpi-tools to /usr/bin

  2. Edit bpi-update in bpi-tools

  • Line 32: comment UBOOTIMGGZ
  • Line 33: BOOTFILES=BPI-BOOT-bpi-cm4.tgz
  • Line 37:comment useless options, add 4.9.241-BPI-CM4-Kernel.tgz, bpi-tools.tgz
  • Around Line 70 ~ Line 80:F_UPDATE = YES; F_GOOGLE = NO
  1. Execute build.sh again to install bootloader and kernels to mircroSD

$ ./build.sh bpi-cm4
cm4_build_sd

  • type 6 to install to SD
  • choose 2,CM4
  • enter SD device, mine is /dev/sdc
  • done
    Screenshot%20from%202023-01-17%2019-34-54

Startup

Lighting
lighting

WiFi Driver

Go to /usr/lib/modules/4.9.241-BPI-CM4/kernel/drivers/net/wireless/realtek/rtl8822cs in CM4 filesystem, then

$ sudo insmod 88x2cs.ko

Furthermore,WiFi driver of this system cannot be loaded from overlay,which can result in failed booting. But uart and i2c are ok, I may take more tests few days later.