CoreMP135 Buildroot

Source Code

1.Visit Github to download the CoreMP135 source code. This project is compiled using the buildroot externel method and is independent of the buildroot source code.

git clone https://github.com/m5stack/CoreMP135_buildroot.git
git clone https://github.com/m5stack/CoreMP135_buildroot-external-st.git

2.Place the two projects in the same directory

├── CoreMP135_buildroot
├── CoreMP135_buildroot-external-st


1.Enter the Core135_buildroot directory and execute the following instructions.

Kernel version
Currently, the project provides two kernel version configurations to choose from, namely m5stack_coremp135_defconfig (kernel version 6.1) and m5stack_coremp135_515_defconfig (kernel version 5.15). The default factory firmware uses the 5.15 kernel version. If it is used to compile the driver, please use the corresponding version.
make BR2_EXTERNAL=../CoreMP135_buildroot-external-st/ m5stack_coremp135_515_defconfig
make -j4

2.After compilation is completed, the generated sdcard.img image file can be obtained in the output/images directory.

Compile driver

1.In the buildroot project of CoreMP135, the screen driver and other contents are added to the source code project through patches. The kernel already contains the drivers for all peripherals on the machine. In subsequent development, you may need to use modules developed by yourself. The following is Hello_world driver example. To compile, you can compile it in the following way and install it into the device.

External module compilation method

1.Create a hello_world_driver folder and contain the following files Makefile, hello_world_driver.c

#include <linux/init.h>
#include <linux/module.h>

MODULE_DESCRIPTION("A simple hello world kernel module");

static int __init hello_world_init(void)
     printk(KERN_INFO "Hello, world!\n");
     return 0;

static void __exit hello_world_exit(void)
     printk(KERN_INFO "Goodbye, world!\n");


2.Point the kernel address in the Makefile to the linux kernel path in the buildroot directory, and the tool chain to the tool chain path used in buildroot. Note: Please modify according to your actual project path

KERN_DIR := /home/sean/workspace/mp135/release/Core135_buildroot/output/build/linux-custom
CROSS_COMPILE := /home/sean/workspace/mp135/release/Core135_buildroot/output/host/bin/arm-none-linux-gnueabihf-
MODULE_NAME := hello_world_driver
PWD := $(shell pwd)

obj-m := $(MODULE_NAME).o



3.Run the following command to compile the module, and the module .ko file will be output.


Compile USB Network Adapte

1.Before CoreMP135 uses a USB wireless network card for network connection, we need to compile the corresponding network card driver and place the driver.ko file and network card firmware into the system to ensure that the network card can be recognized and driven normally. This tutorial will illustrate the compilation and usage process based on the MT7601U USB network card case.

2.After completing the kernel compilation work in the previous step, access the linux kernel directory Core135_buildroot/output/build/linux-custom, use the following instructions and open the configuration page.

make ARCH=arm menuconfig

Path Device Drivers->Network device support->Wireless LANEnable the corresponding network card driver. (For example, this tutorial uses a network card based on MT7601U)
Path Networking support->Wireless, enable cfg80211 - wireless configuration API, cfg80211 wireless extensions compatibility, Generic IEEE 802.11 Networking Stack.

Notes on network card driver:
If the kernel of this version does not have an integrated supported USB network card driver, you need to obtain the driver source code through the official website of the network card. Refer to the tutorial above to generate the driver through external compilation. The kernel version used to compile the driver needs to be consistent with the kernel version running on the machine

3.After enabling and saving the corresponding network card driver, return to the buildroot root directory and use the command make rebuild-linux to recompile the Linux kernel and driver parts. After compilation is completed, the driver .ko file can be obtained in Core135_buildroot/output/target/lib/modules/$version/kernel/drivers/net/wireless.

make rebuild-linux

4.Obtain the firmware file of the USB network card through the official resource website of the network card or contact the supplier, and place it in the file system path /lib/firmware/ of CoreMP135. (Generally, this path can be specified in the kernel compilation option menuconfig, or you can check the actual called file name through the source code. You need to keep the firmware file name consistent with the configuration options, otherwise it cannot be loaded normally. When the loading is abnormal, you can check the error log through the dmesg command. analyse problem). For example, in this case, you need to place the firmware file in the path /lib/firmware/mt7601u.bin.

5.Place the previously compiled network card driver .ko file into /lib/modules/$version/kernel/driver/net/wireless/.

scp -r ./lib/modules/5.15.118/kernel/drivers/net/wireless/mediatek root@

6.Run depmod -a to update the driver dependencies, and then use modprobe mt7601u (driver name) to load the driver. After completing the driver loading, insert the USB network card and check whether the currently available network card is recognized normally. Then you can use nmtui (debian image), wpa_supplicant (buildroot image) for network connection. For related instructions, please refer to Network Configuration Chapter .

depmod -a
modprobe mt7601u
ifconfig -a
On This Page