sipeed / LicheeRV-Nano-Build

LicheeRV-Nano-Build
103 stars 39 forks source link

How to enable frame buffer console #52

Open NathanChiu95 opened 1 month ago

NathanChiu95 commented 1 month ago

Hi, I would like to show the boot logs on the mipi LCD with frame buffer console, but I cannot get it working.

I hv added the following in build\boards\sg200x\sg2002_licheervnano_sd\linux\sg2002_licheervnano_sd_defconfig:

CONFIG_FB=y
# CONFIG_FB_CVITEK=m ## This is origional
CONFIG_FB_CVITEK=y
# CONFIG_FRAMEBUFFER_CONSOLE=y This is new add
CONFIG_FRAMEBUFFER_CONSOLE=y

also, the following in u-boot-2021.10\include\configs\mars-asic.h:

    /* config uart */
    #ifdef MAP_CONSOLE_TO_FBCON
        #define CONSOLEDEV "tty1\0" // This is for fbcon, new added by user
        #define CONSOLEDEV_SERIAL "ttyS0\0"
        #define MAP_FB_CON " fbcon=map:0\0"
    #else
        #define CONSOLEDEV_SERIAL "ttyS0\0"
        #define MAP_FB_CON " "
    #endif
    #define OTHERBOOTARGS   "earlycon=sbi riscv.fwsz="  __stringify(CVIMMAP_OPENSBI_SIZE) " " \
        EARLYCON_RELEASE CONSOLE_LOGLEVEL MAP_FB_CON
    #ifdef MAP_CONSOLE_TO_FBCON // This is for fbcon, new added by user
        #define CONFIG_EXTRA_ENV_SETTINGS   \
            "netdev=eth0\0"     \
            "consoledev=" CONSOLEDEV  \
            "consoledev_serial=" CONSOLEDEV_SERIAL  \
            "baudrate=115200\0" \
            "uImage_addr=" __stringify(UIMAG_ADDR) "\0" \
            "update_addr=" __stringify(UPDATE_ADDR) "\0" \
            "mtdparts=" PARTS "\0" \
            "mtdids=" MTDIDS_DEFAULT "\0" \
            "root=" ROOTARGS "\0" \
            "sddev=0\0" \
            "sdboot=" SD_BOOTM_COMMAND "\0" \
            "sdbootauto=" SD_BOOTM_COMMAND_AUTO "\0" \
            "othbootargs=" OTHERBOOTARGS "\0" \
            "loadenvcmd=mmc info;load mmc 0:1 ${uImage_addr} uEnv.txt; if test $? -eq 0; then env import ${uImage_addr} - ; fi;\0" \
            PARTS_OFFSET
    #else
    #ifdef MAP_CONSOLE_TO_FBCON // This is for fbcon, new added by user
        #define SET_BOOTARGS "setenv bootargs ${reserved_mem} ${root} ${mtdparts} " \
                        "console=$consoledev $othbootargs;"
    #else

so that the bootargs=root=/dev/mmcblk0p2 rootwait rw console=tty1 earlycon=sbi riscv.fwsz=0x80000 loglevel=9 fbcon=map:0

I rebuilt it and created /boot/fb when I do lsmod, soph_fbis enabled and there is existing /dev/fb0

But still, no console was shown on the MIPI LCD

markbirss commented 1 month ago

@NathanChiu95

Kindly share the actual tree you are working from or the complete mars-asic.h file ? It is unclear where and what order you are adding those lines

I last did this on the duo https://www.youtube.com/watch?v=zAN8VrhhglE

Neutree commented 1 month ago

just create a empty file /boot/fb, reboot, then you can use FB

markbirss commented 1 month ago

just create a empty file /boot/fb, reboot, then you can use FB

yes, just shows white screen with sipeed logo, no actual linux framebuffer console yet unfortunately

https://www.youtube.com/shorts/ewWXwE_knXg

NathanChiu95 commented 1 month ago

@NathanChiu95

Kindly share the actual tree you are working from or the complete mars-asic.h file ? It is unclear where and what order you are adding those lines

I last did this on the duo https://www.youtube.com/watch?v=zAN8VrhhglE

Hi markbriss,

Please find the attached mars-asic.h The macro MAP_CONSOLE_TO_FBCON is added by me Thanks

mars-asic.zip