Basic diagnostics kernel
This page describes the "Basic Diagnostics Kernel" that can be found on some supported devices. It includes a small set of tools that can be used to restore the device from scratch if something goes wrong.
Supported devices
Booting on the Basic Diagnostics Kernel (BDK) is supported on devices with two or more physical buttons. The current list is as follows:
- Kobo Touch B/C
- Kobo Glo
How to boot into the BDK
In the bootloader code of supported devices, there is a specific action triggered when the secondary button (e.g. Home button or brightness button) is pressed whilst the bootloader is still loading. In InkBox OS, this code has been modified so that it can load a different kernel, stored at a different sector of the MMC.
Usually, the default InkBox OS kernel load sector is 81920
. However, when the secondary button is pressed, it changes to 19456
, at which position in the MMC is contained the BDK.
Here is a sample serial port log from a device booting the BDK:
U-Boot 2009.08-inkbox (Feb 14 2022 - 19:03:20) CPU: Freescale i.MX50 family 1.1V at 800 MHz mx50 pll1: 800MHz mx50 pll2: 400MHz mx50 pll3: 216MHz ipg clock : 66666666Hz ipg per clock : 66666666Hz uart clock : 24000000Hz ahb clock : 133333333Hz axi_a clock : 400000000Hz axi_b clock : 200000000Hz weim_clock : 100000000Hz ddr clock : 200000000Hz esdhc1 clock : 80000000Hz esdhc2 clock : 80000000Hz esdhc3 clock : 80000000Hz esdhc4 clock : 80000000Hz Board: MX50 RDP board Boot Reason: [POR] Boot Device: SD I2C: ready DRAM: 256 MB MMC: FSL_ESDHC: 0, FSL_ESDHC: 1 In: serial Out: serial Err: serial MMC read: dev # 0, block # 1023, count 1 partition # 0 ... 1 blocks read: OK MMC read: dev # 0, block # 1024, count 1 partition # 0 ... 1 blocks read: OK [only 1 key] 1 keys,0x00,0x01 ************************************** ** Boot to basic diagnostics mode ** ************************************** ram p=70000000,size=268435456 MMC read: dev # 0, block # 1023, count 1 partition # 0 ... 1 blocks read: OK MMC read: dev # 0, block # 1024, count 1 partition # 0 ... 1 blocks read: OK MMC read: dev # 0, block # 18431, count 1 partition # 0 ... 1 blocks read: OK MMC read: dev # 0, block # 14335, count 1 partition # 0 ... 1 blocks read: OK MMC read: dev # 0, block # 14336, count 1899 partition # 0 ... 1899 blocks read: OK Kernel RAM visiable size=255M->255M Hit any key to stop autoboot: 0 Valid chip addresses: 00 43 MMC read: dev # 0, block # 19455, count 1 partition # 0 ... 1 blocks read: OK cmd=mmc read 0 0x7781f9f8 0x4bff 0x1 no kernel image signature ! cmd=mmc read 0 0x70800000 0x4c00 0x4800 MMC read: dev # 0, block # 19456, count 18432 partition # 0 ... 18432 blocks read: OK ## Booting kernel from Legacy Image at 70800000 ... Image Name: Linux-2.6.35.3-inkbox+ Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 5019952 Bytes = 4.8 MB Load Address: 70008000 Entry Point: 70008000 Loading Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. *** InkBox system diagnostics *** Version 1.0, built Sun Mar 6 2022 Available options: 1 - System Info 2 - Battery Info 3 - Graphics test 4 - Memory test 5 - Utilities 6 - Reboot 7 - Power off 8 - Exit to shell Diagnostics =>
As shown above, we get to a Diagnostics =>
prompt, which tells us the BDK is fully started and ready to receive commands.
Interacting with the BDK
In the BDK, often the state of operations and commands executed is shown on the screen, but input is only possible via the serial port. This sections describes how to interact with the BDK.
The main menu presents a list of the possible recovery options we could want to use.
The following explains in detail what each option does.
Serial console
*** InkBox system diagnostics *** Version 1.0, built Sun Mar 6 2022 Available options: 1 - System Info 2 - Battery Info 3 - Graphics test 4 - Memory test 5 - Utilities 6 - Reboot 7 - Power off 8 - Exit to shell Diagnostics =>
System info
Displays information about the running system, such as the kernel version, device identifier (e.g. n905b
), root status (c.f. General_information#Standard_and_Rooted), firmware version, time, memory info and processor info.
Serial console
Diagnostics => 1 ---- General info ---- Kernel version: 2.6.35.3-inkbox+ Device: n905b Status: Rooted F/W version: 1.9 Time: Mon Mar 7 22:19:38 UTC 2022 ---- Memory info ---- MemTotal: 253924 kB MemFree: 194392 kB ---- Processor info ---- Architecture: armv7l < OK >
Battery info
Displays information about the battery status and charge.
Serial console
Diagnostics => 2 Battery status: Charging Battery level: 90% < OK >
Graphics test
Does a graphics test.
Serial console
Diagnostics => 3 Is the gray scale displayed properly? (Y/N) Y Test summary: Gray scale: PASS < OK >
Memory test
Does a memory test.
Serial console
Diagnostics => 4 Found 253924 kB of RAM. Using 126962 kB. Memory test started. memtester version 4.5.0 (32-bit) Copyright (C) 2001-2020 Charles Cazabon. Licensed under the GNU General Public License version 2 (only). pagesize is 4096 pagesizemask is 0xfffff000 want 123MB (130009088 bytes) got 123MB (130009088 bytes), trying mlock ...locked. Loop 1/1: Stuck Address : ok Random Value : ok Compare XOR : ok Compare SUB : ok Compare MUL : ok Compare DIV : ok Compare OR : ok Compare AND : ok Sequential Increment: ok Solid Bits : ok Block Sequential : ok Checkerboard : ok Bit Spread : ok Bit Flip : ok Walking Ones : ok Walking Zeroes : ok 8-bit Writes : ok 16-bit Writes : ok Done. ... Redundant output cut ... < OK >
Utilities
The Utilities option is a subsystem containing various utilities permitting to fully recover the device from the serial port. These options are described below.
Flash kernel to MMC
Flashes a kernel to the (e)MMC. The kernel is loaded on the serial port via the XMODEM
protocol and then flashed at sector 81920
or 19456
of the (e)MMC, depending on the user's choice.
Serial console
Utilities => 1 An XMODEM receiver is now listening on the serial port. Please send the file now and strike CTRL+D when the transfer finishes. Flash 'main' or 'diagnostics' kernel? main Flashing MAIN kernel ... OK: Kernel flashed. < OK >
Flash U-Boot to MMC
Flashes the U-Boot bootloader to the (e)MMC. U-Boot is loaded on the serial port via the XMODEM
protocol and then flashed at the second 1K
sector of the (e)MMC.
Serial console
Utilities => 2 An XMODEM receiver is now listening on the serial port. Please send the file now and strike CTRL+D when the transfer finishes. Flashing U-Boot ... OK: U-Boot flashed. < OK >
Erase MMC
WARNING: This option should never be used, unless you know exactly what you are doing.
Completely erases the (e)MMC and restores the first unpartitioned space, which includes U-Boot.
Serial console
Utilities => 3 CAUTION! This will erase EVERYTHING on the MMC, excluding U-Boot. You have been warned. Continue? (Y/N) Y
Reboot
Reboots the device.
Serial console
Diagnostics => 6 Rebooting ... The system is going down NOW! Sent SIGTERM to all processes Sent SIGKILL to all processes Requesting system reboot [ 105.285660] Restarting system.
Power off
Powers off the device.
Serial console
Diagnostics => 7 Shutting down ... The system is going down NOW! Sent SIGTERM to all processes Sent SIGKILL to all processes Requesting system poweroff [ 7.459963] Power down.
Exit to shell
Spawns a shell, allowing you to run standard Linux commands in a minimal environment.
Serial console
Diagnostics => 8 ---- Exited to shell ---- / # cat /proc/version Linux version 2.6.35.3-inkbox+ (build@inkbox) (gcc version 4.8.1 20130401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.04-20130417 - Linaro GCC 2013.04) ) #1 PREEMPT Sun Mar 6 14:50:52 EST 2022 / # uptime 23:04:41 up 5 min, 0 users, load average: 0.99, 0.64, 0.27 / # date Mon Mar 7 23:04:46 UTC 2022 / #