Enabling the MMC drivers in linux

The first thing to do is to enable to MMC drivers in linux. To do this simply and fast we will just use another default config. Where in the previous chapter we used nommu_k210_defconfig we will now use nommu_k210_sdcard_defconfig. Besides that we will also tell linux to generate an specific target for use to use as dtb. Where we used k210_generic.dtb we will now use sipeed_maix_bit.dtb. But first enable the defconfig.

ARCH=riscv CROSS_COMPILE=riscv64-linux- make nommu_k210_sdcard_defconfig

After that we will enter the menuconfig (See previous chapter how). Here we will specify the correct target. To do that navigate to Soc selection and select the option Source file for the Canaan Kendryte K210 builtin DTB and change the value from k210_generic to sipeed_maix_bit. After this exit and save the config and rebuilt the kernel. After you have rebuilt the kernel copy the new Image and the sipeed_maix_bit.dtb file to the sd-card.

Booting the new kernel

After the new kernel is copied to the sd-card we can boot into u-boot. Here we will do almost the same as in the previous chapter only we will replace the filename of the dtb with the new filename.

fatload mmc 0 $loadaddr Image && fatload mmc 0 $fdt_addr_r sipeed_maix_bit.dtb && booti $loadaddr - $fdt_addr_r

mmc isn’t detected when booted from u-boot. When uploading kernel into mcu flash it works(At leasts it is detected; it can’t execute the init). But flashing is slow so you want to boot from u-boot. But whhaaaa.