3

I recomplie the Raspbian kernel for Cirrus Logic audio card, following this description.

https://github.com/CirrusLogic/rpi-linux/wiki/Building-the-code

and I wonder what does mkknlimg exaclty do.

and I found these:

"Note that DT and ATAGs are mutually exclusive. As a result, passing a DT blob to a kernel that doesn't understand it causes a boot failure. To guard against this, the loader checks kernel images for DT-compatibility, which is marked by a trailer added by the mkknlimg utility; this can be found here, or in the scripts directory of a recent kernel source tree. Any kernel without a trailer is assumed to be non-DT-capable." at https://www.raspberrypi.org/documentation/configuration/device-tree.md

What I found: From ATAGs I found that They are used to pass physical memory layouts to the kernel at booting process on ARM arch, and they are incompatible with the Device Tree blob.

My question: What is a "trailer"?

4

It's just a blob of data at the end of the kernel image. Observe:

# knlinfo /boot/kernel7.img
Kernel trailer found at 4222224/0x406d10:
  KVer: "Linux version 4.4.8-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #880 SMP Fri Apr 22 21:55:04 BST 2016"
  DTOK: y
  DDTK: y
  270X: 01000000
  283X: 00000000
  283x: n

Note how the blob is starting at offset 4222224. Compare the above with what's there:

# dd if=/boot/kernel7.img bs=1 skip=4222224 | hd 
00000000  00 00 00 00 00 00 00 00  00 00 00 00 04 00 00 00  |................|
00000010  32 38 33 78 00 00 00 00  04 00 00 00 32 38 33 58  |283x........283X|
00000020  01 00 00 00 04 00 00 00  32 37 30 58 01 00 00 00  |........270X....|
00000030  04 00 00 00 44 44 54 4b  01 00 00 00 04 00 00 00  |....DDTK........|
00000040  44 54 4f 4b 4c 69 6e 75  78 20 76 65 72 73 69 6f  |DTOKLinux versio|
00000050  6e 20 34 2e 34 2e 38 2d  76 37 2b 20 28 64 63 34  |n 4.4.8-v7+ (dc4|
00000060  40 64 63 34 2d 58 50 53  31 33 2d 39 33 33 33 29  |@dc4-XPS13-9333)|
00000070  20 28 67 63 63 20 76 65  72 73 69 6f 6e 20 34 2e  | (gcc version 4.|
00000080  39 2e 33 20 28 63 72 6f  73 73 74 6f 6f 6c 2d 4e  |9.3 (crosstool-N|
00000090  47 20 63 72 6f 73 73 74  6f 6f 6c 2d 6e 67 2d 31  |G crosstool-ng-1|
000000a0  2e 32 32 2e 30 2d 38 38  2d 67 38 34 36 30 36 31  |.22.0-88-g846061|
000000b0  31 29 20 29 20 23 38 38  30 20 53 4d 50 20 46 72  |1) ) #880 SMP Fr|
000000c0  69 20 41 70 72 20 32 32  20 32 31 3a 35 35 3a 30  |i Apr 22 21:55:0|
000000d0  34 20 42 53 54 20 32 30  31 36 00 00 96 00 00 00  |4 BST 2016......|
000000e0  4b 56 65 72 f0 00 00 00  04 00 00 00 52 50 54 4c  |KVer........RPTL|
000000f0

Cute, huh? :)

/ji

PS: I'm also futzing around with a cirrus logic card; I got it to work without any problems, just cross-compiling.

  • Nice. Did you install the device tree blob DTB file in /boot/overlays? – PaulF8080 Apr 30 '16 at 9:21
  • another satisfied customer :) – JayEye May 1 '16 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.