Boot

“正在啟動核心…”之後,控制台上不再顯示任何輸出

  • September 3, 2017

我正在我的Creator CI20 (v1)上嘗試更新的核心,但如果我嘗試使用 Linux 核心版本 4.11.1,我在 u-boot 後無法獲得任何輸出。這導致以下輸出:

ci20# bootm 0x88000000;
## Booting kernel from Legacy Image at 88000000 ...
  Image Name:   Linux-4.11.1
  Image Type:   MIPS Linux Kernel Image (uncompressed)
  Data Size:    5043676 Bytes = 4.8 MiB
  Load Address: 80010000
  Entry Point:  8035d440
  Verifying Checksum ... OK
  Loading Kernel Image ... OK

Starting 

筆記型電腦的步驟:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
$ git checkout v4.11.1
$ make ARCH=mips ci20_defconfig
$ make ARCH=mips CROSS_COMPILE=mipsel-linux-gnu- uImage
$ sudo cp arch/mips/boot/uImage.bin /tftpboot/uImage.4.11.1
$ sudo screen /dev/ttyUSB0 115200 

來自 ci20 的步驟:

dhcp 0x88000000 192.168.0.14:uImage.4.11.1
bootm 0x88000000;

如果我現在使用 4.10.1 重複完全相同的步驟,一切都會按預期進行,我可以看到核心啟動良好:

$ git checkout v4.10.1
$ make ARCH=mips ci20_defconfig
$ make ARCH=mips CROSS_COMPILE=mipsel-linux-gnu- uImage
$ sudo cp arch/mips/boot/uImage.bin /tftpboot/uImage.4.10.1

以供參考:

$ grep CONFIG_CMDLINE ./arch/mips/configs/ci20_defconfig
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"

我應該如何追踪 tty/uart 不顯示任何內容的問題(不訴諸 git bisect 操作)?

由於我沒有收到任何答案/建議,我最終決定git bisect在兩個標籤之間進行一次痛苦的操作(約 13 次迭代):v4.10.1(好)和 v4.11.1(壞)。

這導致我:

% git bisect good
73fbc1eba7ffa3bf0ad12486232a8a1edb4e4411 is the first bad commit
commit 73fbc1eba7ffa3bf0ad12486232a8a1edb4e4411
Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Date:   Wed Nov 23 14:43:49 2016 +0100

   MIPS: fix mem=X@Y commandline processing

   When a memory offset is specified through the commandline, add the
   memory in range PHYS_OFFSET:Y as reserved memory area.
   Otherwise the bootmem allocator is initialised with low page equal to
   min_low_pfn = PHYS_OFFSET, and in free_all_bootmem will process pages
   starting from min_low_pfn instead of PFN(Y).

   Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
   Cc: linux-mips@linux-mips.org
   Patchwork: https://patchwork.linux-mips.org/patch/14613/
   Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

:040000 040000 fe26fcf6d072cbaedac5a417f9f6424df16d331c b99681a22464164b88c6a3cf77b1b87957cd95d6 M  arch

盯著這裡的線上程式碼讓我意識到問題出在我目前的 u-boot 設置中,它指出:

ci20# printenv 
baudrate=115200 
board_date=20140704 
board_mfr=NP 
bootargs=console=ttyS4,115200 console=tty0 mem=256M@0x0 
mem=768M@0x30000000 rootwait quiet rw root=/dev/mmcblk0p1 
bootcmd=run ethargs; ext4load mmc 0:1 0x88000000 /boot/uImage; bootm 0x88000000 
bootdelay=1 
ethact=dm9000 
ethaddr=d0:31:10:ff:7d:20 
ethargs=env set bootargs ${bootargs} dm9000.mac_addr=${ethaddr} 
loads_echo=1 
serial#=1255 
stderr=eserial0,eserial4 
stdin=eserial0,eserial4 
stdout=eserial0,eserial4 

Environment size: 488/32764 bytes 

我還沒有測試過它,但看起來memenv 變數總是被初始化為一個虛假的值(我按照說明操作),但這只是最近才開始成為一個問題。

以下可能表示複製/粘貼錯誤:

bootargs=console=ttyS4,115200 console=tty0 mem=256M@0x0 
mem=768M@0x30000000 rootwait quiet rw root=/dev/mmcblk0p1 

原來這是引入的實際回歸:

引用自:https://unix.stackexchange.com/questions/389268