diff mbox series

[v2,21/21] riscv: Add Canaan Kendryte K210 SD card defconfig

Message ID 20201124043728.199852-22-damien.lemoal@wdc.com
State New
Headers show
Series RISC-V Kendryte K210 support improvements | expand

Commit Message

Damien Le Moal Nov. 24, 2020, 4:37 a.m. UTC
The nommu_k210_defconfig default configuration allows booting a K210
SoC based board using an embedded intramfs cpio file. Modifying this
configuration to enable support for the board SD card is not
trivial for all users. To help beginners getting started with this
board, add the nommu_k210_sdcard_defconfig default configuration file
to set all configuration options necessary to use the board mmc-spi
sd card for the root file system. This configuration adds support for
the block layer, the mmc-spi driver and modifies the boot options to
specify the rootfs device as mmcblk0p1 (first partition of the sd card
block device). The ext2 file system is selected by default to encourage
its use as that results in only about 4KB added to the kernel image
size. The default device tree compiled in is unchanged and must be
replaced by the user with the device tree suitable for the board being
used (k210_maix_bit, k210_maix_dock, k210_maix_go, k210_maixduino or
k210_kd233).

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 .../riscv/configs/nommu_k210_sdcard_defconfig | 90 +++++++++++++++++++
 1 file changed, 90 insertions(+)
 create mode 100644 arch/riscv/configs/nommu_k210_sdcard_defconfig

Comments

Geert Uytterhoeven Nov. 24, 2020, 6:51 p.m. UTC | #1
Hi Damien,

On Tue, Nov 24, 2020 at 5:39 AM Damien Le Moal <damien.lemoal@wdc.com> wrote:
> The nommu_k210_defconfig default configuration allows booting a K210
> SoC based board using an embedded intramfs cpio file. Modifying this
> configuration to enable support for the board SD card is not
> trivial for all users. To help beginners getting started with this
> board, add the nommu_k210_sdcard_defconfig default configuration file
> to set all configuration options necessary to use the board mmc-spi
> sd card for the root file system. This configuration adds support for
> the block layer, the mmc-spi driver and modifies the boot options to
> specify the rootfs device as mmcblk0p1 (first partition of the sd card
> block device). The ext2 file system is selected by default to encourage
> its use as that results in only about 4KB added to the kernel image
> size. The default device tree compiled in is unchanged and must be
> replaced by the user with the device tree suitable for the board being
> used (k210_maix_bit, k210_maix_dock, k210_maix_go, k210_maixduino or
> k210_kd233).
>
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>

While ext2 is definitely cheaper than ext4 (the latter takes almost +200
KiB, ugh), ext2 does not have journaling.
Hence your root file system will be unclean all the time, unless you always
manage to unmount it before reboot.  And your default buildroot
does not have e2fsck.

Gr{oetje,eeting}s,

                        Geert
Damien Le Moal Nov. 25, 2020, 12:05 a.m. UTC | #2
On Tue, 2020-11-24 at 19:51 +0100, Geert Uytterhoeven wrote:
> Hi Damien,

> 

> On Tue, Nov 24, 2020 at 5:39 AM Damien Le Moal <damien.lemoal@wdc.com> wrote:

> > The nommu_k210_defconfig default configuration allows booting a K210

> > SoC based board using an embedded intramfs cpio file. Modifying this

> > configuration to enable support for the board SD card is not

> > trivial for all users. To help beginners getting started with this

> > board, add the nommu_k210_sdcard_defconfig default configuration file

> > to set all configuration options necessary to use the board mmc-spi

> > sd card for the root file system. This configuration adds support for

> > the block layer, the mmc-spi driver and modifies the boot options to

> > specify the rootfs device as mmcblk0p1 (first partition of the sd card

> > block device). The ext2 file system is selected by default to encourage

> > its use as that results in only about 4KB added to the kernel image

> > size. The default device tree compiled in is unchanged and must be

> > replaced by the user with the device tree suitable for the board being

> > used (k210_maix_bit, k210_maix_dock, k210_maix_go, k210_maixduino or

> > k210_kd233).

> > 

> > Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>

> 

> While ext2 is definitely cheaper than ext4 (the latter takes almost +200

> KiB, ugh), ext2 does not have journaling.


Yes. With ext4, kernel size jumps from 1.78 MB to over 2.00 MB (rv64 gcc 9.3).
Even vfat is more expensive than ext2 in terms of kernel size.

> Hence your root file system will be unclean all the time, unless you always

> manage to unmount it before reboot.  And your default buildroot

> does not have e2fsck.


Yes. I was using embedded rootfs cpio file until I got the SD card working with
Sean's help, so I was not adding e2fsck to save space. I will add it.
As for the fs being always unclean on mount, I know, this is not super nice. I
think that adding rootflags=noatime to the boot params will help in avoiding
the FS to break, but that is a little weak. For use cases where the SD card is
used only for reading applications/shell commands, mounting ro should be the
first choice, which may be a more sensible default for the defconfig. I will
update the defconfig with that.

> 

> Gr{oetje,eeting}s,

> 

>                         Geert

> 


-- 
Damien Le Moal
Western Digital
diff mbox series

Patch

diff --git a/arch/riscv/configs/nommu_k210_sdcard_defconfig b/arch/riscv/configs/nommu_k210_sdcard_defconfig
new file mode 100644
index 000000000000..3d2cb4747e7f
--- /dev/null
+++ b/arch/riscv/configs/nommu_k210_sdcard_defconfig
@@ -0,0 +1,90 @@ 
+# CONFIG_CPU_ISOLATION is not set
+CONFIG_LOG_BUF_SHIFT=13
+CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+# CONFIG_SYSFS_SYSCALL is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_BASE_FULL is not set
+# CONFIG_FUTEX is not set
+# CONFIG_EPOLL is not set
+# CONFIG_SIGNALFD is not set
+# CONFIG_TIMERFD is not set
+# CONFIG_EVENTFD is not set
+# CONFIG_AIO is not set
+# CONFIG_IO_URING is not set
+# CONFIG_ADVISE_SYSCALLS is not set
+# CONFIG_MEMBARRIER is not set
+# CONFIG_KALLSYMS is not set
+CONFIG_EMBEDDED=y
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLOB=y
+# CONFIG_MMU is not set
+CONFIG_SOC_CANAAN=y
+CONFIG_SOC_CANAAN_K210_DTB_SOURCE="k210_generic"
+CONFIG_MAXPHYSMEM_2GB=y
+CONFIG_SMP=y
+CONFIG_NR_CPUS=2
+CONFIG_CMDLINE="earlycon console=ttySIF0 rootdelay=2 root=/dev/mmcblk0p1 rw"
+CONFIG_CMDLINE_FORCE=y
+# CONFIG_SECCOMP is not set
+# CONFIG_STACKPROTECTOR is not set
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_BINFMT_FLAT=y
+# CONFIG_COREDUMP is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_ALLOW_DEV_COREDUMP is not set
+# CONFIG_BLK_DEV is not set
+# CONFIG_INPUT_LEDS is not set
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_LDISC_AUTOLOAD is not set
+# CONFIG_HW_RANDOM is not set
+# CONFIG_DEVMEM is not set
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_HELPER_AUTO is not set
+CONFIG_I2C_DESIGNWARE_PLATFORM=y
+CONFIG_SPI=y
+# CONFIG_SPI_MEM is not set
+CONFIG_SPI_DESIGNWARE=y
+CONFIG_SPI_DW_MMIO=y
+CONFIG_GPIO_SYSFS=y
+# CONFIG_GPIO_CDEV_V1 is not set
+CONFIG_GPIO_DWAPB=y
+CONFIG_GPIO_SIFIVE=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_SYSCON=y
+# CONFIG_HWMON is not set
+# CONFIG_VGA_CONSOLE is not set
+# CONFIG_HID is not set
+# CONFIG_USB_SUPPORT is not set
+CONFIG_MMC=y
+# CONFIG_PWRSEQ_EMMC is not set
+# CONFIG_PWRSEQ_SIMPLE is not set
+CONFIG_MMC_SPI=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_USER=y
+# CONFIG_VIRTIO_MENU is not set
+# CONFIG_VHOST_MENU is not set
+CONFIG_EXT2_FS=y
+# CONFIG_FILE_LOCKING is not set
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY_USER is not set
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_LSM="[]"
+CONFIG_PRINTK_TIME=y
+# CONFIG_SYMBOLIC_ERRNAME is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MISC is not set
+CONFIG_PANIC_ON_OOPS=y
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_FTRACE is not set
+# CONFIG_RUNTIME_TESTING_MENU is not set