打开CMDLINE中的 ” earlyprink “ 参数
點(diǎn)擊打開鏈接
解決問題的過程中,好文章推薦,都保存在火狐wilson_sq@qq.com記錄中~~~~~~~~
grep -r "earlyprintk" kernel
kernel/Documentation/driver-model/platform.txt:should use early_platform_init("earlyprintk", &platform_driver).
./arch/sh/configs/sh2007_defconfig:CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1"
./arch/sh/configs/rsk7203_defconfig:CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
./arch/sh/configs/migor_defconfig:CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 earlyprintk=serial ip=on root=/dev/nfs ip=dhcp"
./arch/sh/configs/sdk7786_defconfig:CONFIG_CMDLINE="console=ttySC1,115200 earlyprintk=sh-sci.1,115200 root=/dev/sda1 nmi_debug=state,debounce rootdelay=5 pmb=iomap ignore_loglevel"
./arch/sh/configs/rsk7201_defconfig:CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
./arch/sh/configs/shx3_defconfig:CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=bios ignore_loglevel"
/************************************
全盤搜索earlyprintk查看其調(diào)用過程
***************************************/
全盤搜索earlyprintk查看其調(diào)用過程
①在kernel-parameters.txt中有如下描述,看我們的對應(yīng)哪個,
earlyprintk= ?[X86,SH,BLACKFIN,ARM] earlyprintk=vga
earlyprintk=xen
earlyprintk=serial[,ttySn[,baudrate]]
earlyprintk=serial[,0x...[,baudrate]]
earlyprintk=ttySn[,baudrate]
earlyprintk=dbgp[debugController#]
最終我們調(diào)用的是:earlyprintk=msm_hsl_uart,0x078b0000 。 ? ? ?0x078b0000是uart2的基地址
/************************************
? ? ? 確定uart2的基地址:
***************************************/ ?
cd /android/kernel/arch/arm64/boot/dts
grep -r "uart" . |grep 8916
看到一下幾行
./qcom/msm8916.dtsi: ? ? ? ? ? ?pinctrl-0 = <&hsuart_sleep>;
./qcom/msm8916.dtsi: ? ? ? ? ? ?pinctrl-1 = <&hsuart_active>;
./qcom/msm8916.dtsi: ? ?blsp1_uart2: serial@78b0000 {
./qcom/msm8916.dtsi: ? ? ? ? ? ?compatible = "qcom,msm-lsuart-v14";
./qcom/msm8916.dtsi: ? ? ? ? ? ?clocks = <&clock_gcc clk_gcc_blsp1_uart2_apps_clk>,
這里的blsp1_uart2: serial@78b0000 ? 中的78b0000就是基地址
手冊中也可以查到這個 基地址
如果啟動過程中沒有相關(guān)的打印顯示,則應(yīng)打開必要的打印:
#CONFIG_SERIAL_MSM_HS=y
#CONFIG_SERIAL_MSM_HSL=y
#CONFIG_SERIAL_MSM_HSL_CONSOLE=y
CONFIG_CMDLINE的位置:
①android/device/qcom/msm8916_64/BoardConfig.mk ? ? ? ?/************/earlyprintk在這里設(shè)置后,./build.sh kernel后boot.img沒有重新生成。。
②android/kernel/arch/arm/boot/dts/qcom/msm8939.dtsi 里搜索chosen{有bootargs的設(shè)置}
③android/bootable/bootloader/lk/app/aboot/aboot.c
內(nèi)核中查看cmdlines
cat /proc/cmdlines
過程中遇到的問題:在改動①android/device/qcom/msm8916_64/BoardConfig.mk中的CMDLINE后,應(yīng)該將生成目錄中的/android/out目錄重新刪除,否則./build.sh kernel命令執(zhí)行后不更新boot.img
打印的log中搜索earlyprink/earlycon/bootconsoles,看到有一下打印
在一下程序中找到:原因是只有CMDLINE+ earlyprintk,而沒有給earlyprink賦值
if (!buf) {
pr_warning("No earlyprintk arguments passed.\n");
return 0;
}
kernel-parameters.txt中有如下描述
earlycon= ?[KNL] Output early console device and options. uart[8250],io,<addr>[,options]
uart[8250],mmio,<addr>[,options]
uart[8250],mmio32,<addr>[,options] Start an early, polled-mode console on the 8250/16550
UART at the specified I/O port or MMIO address.
MMIO inter-register address stride is either 8-bit
(mmio) or 32-bit (mmio32).
The options are the same as for ttyS, above.
*********************earlycon******************
earlycon根據(jù)其他的config文件中的設(shè)置一下
//grep -r “earlycon” ? *config
./drivers/tty/serial/8250/Kconfig: ?"earlycon=uart8250,io,0x3f8,9600n8"
./drivers/tty/serial/8250/Kconfig: ?"earlycon=uart8250,mmio,0xff5e0000,115200n8".
void __init parse_early_options(char *cmdline)
parse_args("early options", cmdline, NULL, 0, 0, 0, do_early_param);
parse_one(param, val, doing, params, num, min_level, max_level, unknown);
handle_unknown(param, val, doing); ? ? ? ?doing="early options"
另一種啟動方式:
fastboot -c ? "earlyprintk=msm_hsl_uart,0x078b0000" boot ? boot.img可以通過fastboot啟動指定內(nèi)核。雖然啟動沒成功,但是大概命令應(yīng)該沒錯~~~有待改進(jìn)。。
google里搜索No earlyprintk arguments passed
https://lists.linaro.org/pipermail/linaro-kernel/2013-May/004416.html這篇文章好像可已解決問題
正常串口的設(shè)置: ? ?CMDLINE中的console=ttyHSL0,115200,n8 參數(shù)
platform_driver_register(&msm_hsl_platform_driver);
msm_hsl_platform_driver
msm_serial_hsl_probe
uart_add_one_port(&msm_hsl_uart_driver, port);
uport->cons = drv->cons;
uart_configure_port(drv, state, uport);
uart_configure_port(struct uart_driver *drv, struct uart_state *state,struct uart_port *port)
register_console(port->cons);
uart_add_one_port(&msm_hsl_uart_driver, port);
static struct uart_driver msm_hsl_uart_driver = {
.owner = THIS_MODULE,
.driver_name = "msm_serial_hsl",
.dev_name = "ttyHSL",
.nr = UART_NR,
.cons = msm_hsl_console,
};
static struct console msm_hsl_console = {
.name = "ttyHSL",
.write = msm_hsl_console_write,
.device = uart_console_device,
.setup = msm_hsl_console_setup,
.flags = CON_PRINTBUFFER,
.index = -1,
.data = &msm_hsl_uart_driver,
};
uart_console_write(port, s, count, msm_hsl_console_putchar);
msm_hsl_console_putchar(struct uart_port *port, int ch)
msm_hsl_write(port, ch, regmap[vid][UARTDM_TF]);
總結(jié)
以上是生活随笔為你收集整理的打开CMDLINE中的 ” earlyprink “ 参数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 10个重要的Linux ps命令实战
- 下一篇: linux中 probe函数的何时调用的