The (patched) kernel used in the Tolino Shine was made available (by accident) a few weeks ago. I mirrored the archive here:
Extract the archive, export the path to the toolchain (if not done yet) and compile the kernel:
>export PATH=$PATH:/home/devel/projects/tolino_shine/own_uboot/kobo/gcc-linaro-arm-linux-gnueabihf-4.8-2013.04-20130417_linux/bin/ >make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
U-boot uses a little header in front of images (kernel, initrd, …) to store informations about the content (so it knows how to handle the image data). Normally you could compile the kernel directly as u-boot compatible image by using the make target uImage – but lets do that by hand to see how it works (we need that u-boot header thingy again when it comes down to the initrd – so it is not about wasting time, won’t hurt and is done with one line… ).
_note: The mkimage tool is located in the tools folder of the u-boot sources so we need to export that path.
>export PATH=$PATH:/home/devel/projects/tolino_shine/own_uboot/uboot-imx/tools/ >mkimage -A arm -O linux -T kernel -C none -a 0x70008000 -e 0x70008000 -n "Shine Kernel" -d zImage shine_kernel.uboot Image Name: Shine Kernel Created: Sun Jun 23 16:13:38 2013 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3275528 Bytes = 3198.76 kB = 3.12 MB Load Address: 70008000 Entry Point: 70800000
_note: I took the address parameters -a (load address) and -e (execute address) from the original u-boot.
From ntx_comm.c (#define SD_OFFSET_SECS_KERNEL 2048) and the boot log (MMC read: dev # 0, block # 2048, count 8192 partition # 0 ) we know that the boot-loader expects the kernel at 0x800*0x200 = 0x100000 on the SD card.
_note: the #define DEFAULT_LOAD_KERNEL_SZ 8192 sets the maximum for the kernel size (here 4MB)
So lets write our u-boot header equipped kernel to that position on the disk…
#>dd if=shine_kernel.uboot of=/dev/SDCARD seek=2048 bs=512
It boots… and crashes:
MMC read: dev # 0, block # 1, count 1 partition # 0 ... 1 blocks read: OK hwcfg rootfstype : 2 hwcfg partition type : 7 ## Booting kernel from Legacy Image at 70800000 ... Image Name: Shine Kernel Created: 2013-06-23 16:05:55 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3275528 Bytes = 3.1 MB Load Address: 70008000 Entry Point: 70008000 Loading Kernel Image ... OK OK - Starting kernel ... - Uncompressing Linux... done, booting the kernel. Initializing cgroup subsys cpu Linux version 126.96.36.199 (devel@bigplay) (gcc version 4.8.1 20130401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.04-20130417 - Linaro GCC 2013.04) ) #109 PREEMPT Sun Jun 23 00:15:35 CEST 2013 CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7 .................. mxc_epdc_fb_fw_handler-3619] drivers/video/mxc/mxc_epdc_fb.c(3654):EPD 1024x758 Unable to handle kernel NULL pointer dereference at virtual address 00000026 pgd = 80004000  *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT last sysfs file: Modules linked in: CPU: 0 Not tainted (188.8.131.52 #109) PC is at epdc_firmware_func+0x10c/0x2a4 LR is at epdc_firmware_func+0x68/0x2a4 ................
The last regular output prints a file (drivers/video/mxc/mxc_epdc_fb.c) and a line number (3654). A few lines later (3694) some data is copied from waveform… remember the u-boot output @ boot:
........... MMC read: dev # 0, block # 14335, count 1 partition # 0 ... 1 blocks read: OK no "waveform" bin header ...........
Yeah, it is missing- and the code will crash if it is not there. Learned: it seems the waveform contains the frame buffer configuration. Same procedure as every year: extract the waveform image from the SD card backup and put it on our new card… The header including the magic number starts at 0x6ffff0. The size is given at mem(magic number + 8) -> (AF 66 11 00). Interpreted as an unsigned long we got a size of 1140399 bytes (but we copy 1140431 := 1140399 + 32 byte header). The waveform data starts at 0x700000. Copy now!
>dd if=first_16_mb_sd_card.img of=waveform.img bs=1 skip=7340016 count=1140431 #>dd if=waveform.img of=/dev/SDCARD bs=1 seek=7340016 obs=512
Insert the card, cross the fingers – boot… works :). On boot the display is initialized – the screen turns black for two times. But now the kernel dies with:
VFS: Cannot open root device "mmcblk0p1" or unknown-block(179,1) Please append a correct "root=" boot option; here are the available partitions: b300 1966080 mmcblk0 driver: mmcblk Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1) [<8003d250>] (unwind_backtrace+0x0/0xe0) from [<8046c620>] (panic+0x68/0xd8) [<8046c620>] (panic+0x68/0xd8) from [<80008e50>] (mount_block_root+0x1c0/0x200) [<80008e50>] (mount_block_root+0x1c0/0x200) from [<800090c0>] (prepare_namespace+0x128/0x17c) [<800090c0>] (prepare_namespace+0x128/0x17c) from [<80008aac>] (kernel_init+0x120/0x17c) [<80008aac>] (kernel_init+0x120/0x17c) from [<80039954>] (kernel_thread_exit+0x0/0x8)
But that is okay and will be fixed in the next part. (Complete boot log including kernel: here)