View Single Post
Old 06-15-2012, 09:52 AM   #370
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by rynax View Post
Other than the diags partition,
do you need a main kernel in "kernel" or a diags kernel in "diags_kernel" or both to be able to go into diags mode?
To boot to diags, you need a diags partition installed, and a compatible diags kernel. In general, for main and diags, 5.0.1-5.0.3 use a 5.0.0 kernels, but 5.0.4 and 5.1.0 each have their own kernels. Do not swap main and diags kernels (they must match their boot partitions).

Technical Details:
Spoiler:
The kernels are linux kernels. Main and diags use different kernels, with different drivers built in (so they are different sizes). The each have their own storage space reserved in the mmc partitions.

There are two u-boot bootloaders. The initial u-boot is small enough to fit in the SoC RAM (with DRAM turned off). It turns on and configures DRAM, then if you need extra functionality like fastboot mode (or other boot-time diagnostic functions), it loads the larger u-boot bist (built-in self-test) image into DRAM and runs it.

Because u-boot bist is larger, it has room for a better battery charger algorithm, which is why I have recommended charging a dead battery on a bricked kindle in fastboot mode.

On the K4 and K5, there are also two linux kernels (main and diags), each located in their own mmc partition. They can be replaced by flashing a new image file to them with fastboot. The main kernel should only be flashed with a main kernel image. The diags kernel should only be flashed with a diags kernel image. Also, you should keep the kernel versions matching the one that amazon shipped with whatever version of boot partitions you use.

During startup, u-boot loads a linux kernel (main or diags, depending on bootmode var) into DRAM and runs it. The kernels contain a small initrd (RAM disk) image that loads and runs a few scripts and loads some critical loadable device drivers, then continues booting by mounting the main or diags boot partitions and loading and running stuff from there, until either the desktop framework or the diags menu appears.

During main boot, if it sees ENABLE_DIAGS on the USB (user store) partition, it changes the bootmode var to diags and reboots.

Using MfgTool, you can boot to fastboot, or main, or diags WITHOUT changing the bootmode var, and regardless of whether or not there is an ENABLE_DIAGS file.

Beware that fastboot mode drops out if there is an interruption of the USB connection, such as when resetting the USB port, or disconnecting the cable, or switching between Windows and linux. The two solutions are to change the bootmode var to fastboot using the diags "install fastboot bundle" option in the diags exit menu, or to stay in windows after running MfgTool and use the win32 version of fastboot (to prevent interrupting the USB connection).
geekmaster is offline   Reply With Quote