diff options
author | David-John Willis <John.Willis@Distant-earth.com> | 2012-04-12 22:21:28 +0100 |
---|---|---|
committer | David-John Willis <John.Willis@Distant-earth.com> | 2012-04-12 22:21:28 +0100 |
commit | 58aec28df8b749431bc217094768561c54ed5867 (patch) | |
tree | 6da76807b4763dd531ec2775b3419c7c57419d90 | |
parent | 7dbc0ca1103d3ce445947979272038502ccf6cb0 (diff) | |
download | meta-raspberrypi-58aec28df8b749431bc217094768561c54ed5867.tar.gz |
bcm2835-kernel-image: Add recipe to deal with prepending the 32KB header to the kerenl image.
* TODO: Clean up these recipes and merge -mkimage and -kernel-image.
-rw-r--r-- | recipes-bcm/kernel-image/bcm2835-kernel-image.bb | 17 | ||||
-rw-r--r-- | recipes-bcm/kernel-image/bcm2835-mkimage.bb | 31 | ||||
-rw-r--r-- | recipes-bcm/kernel-image/bcm2835-mkimage/LICENCE | 3 | ||||
-rw-r--r-- | recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-args-uncompressed.txt | 12 | ||||
-rw-r--r-- | recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-boot-uncompressed.txt | 17 | ||||
-rw-r--r-- | recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-kernel-first32k.bin | bin | 0 -> 32768 bytes | |||
-rw-r--r-- | recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-mkimage.py | 51 |
7 files changed, 131 insertions, 0 deletions
diff --git a/recipes-bcm/kernel-image/bcm2835-kernel-image.bb b/recipes-bcm/kernel-image/bcm2835-kernel-image.bb new file mode 100644 index 0000000..06325f8 --- /dev/null +++ b/recipes-bcm/kernel-image/bcm2835-kernel-image.bb | |||
@@ -0,0 +1,17 @@ | |||
1 | DESCRIPTION = "Helper recipe to make the munged kernel.img image for the RaspberryPi." | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" | ||
4 | |||
5 | PR = "${MACHINE_KERNEL_PR}.0" | ||
6 | DEPENDS = "bcm2835-bootfiles bcm2835-mkimage-native" | ||
7 | |||
8 | S = "${WORKDIR}" | ||
9 | |||
10 | addtask deploy before do_package after do_install | ||
11 | |||
12 | do_deploy() { | ||
13 | install -d ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles | ||
14 | bcm2835-mkimage.py ${DEPLOY_DIR_IMAGE}/zImage-${MACHINE}.bin ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/kernel.img ${STAGING_BINDIR_NATIVE}/ | ||
15 | } | ||
16 | |||
17 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
diff --git a/recipes-bcm/kernel-image/bcm2835-mkimage.bb b/recipes-bcm/kernel-image/bcm2835-mkimage.bb new file mode 100644 index 0000000..5afca12 --- /dev/null +++ b/recipes-bcm/kernel-image/bcm2835-mkimage.bb | |||
@@ -0,0 +1,31 @@ | |||
1 | DESCRIPTION = "Tools to append 32KB binary header to kernel image." | ||
2 | LICENSE = "proprietary-binary" | ||
3 | PR = "${MACHINE_KERNEL_PR}.2" | ||
4 | |||
5 | SECTION = "bootloader" | ||
6 | |||
7 | LIC_FILES_CHKSUM = "file://LICENCE;md5=3d7292881293368c0a9f3bc521c2b87e" | ||
8 | |||
9 | SRC_URI = " \ | ||
10 | file://LICENCE \ | ||
11 | file://bcm2835-args-uncompressed.txt \ | ||
12 | file://bcm2835-boot-uncompressed.txt \ | ||
13 | file://bcm2835-mkimage.py \ | ||
14 | file://bcm2835-kernel-first32k.bin \ | ||
15 | " | ||
16 | |||
17 | S = "${WORKDIR}" | ||
18 | |||
19 | BBCLASSEXTEND = "native nativesdk" | ||
20 | |||
21 | do_install () { | ||
22 | install -d ${D}${bindir} | ||
23 | install -m 0755 bcm2835-mkimage.py ${D}${bindir} | ||
24 | install -m 0644 bcm2835-args-uncompressed.txt ${D}${bindir} | ||
25 | install -m 0644 bcm2835-boot-uncompressed.txt ${D}${bindir} | ||
26 | install -m 0644 bcm2835-kernel-first32k.bin ${D}${bindir} | ||
27 | } | ||
28 | |||
29 | FILES_${PN} = " \ | ||
30 | ${bindir}/bcm2835-* \ | ||
31 | " | ||
diff --git a/recipes-bcm/kernel-image/bcm2835-mkimage/LICENCE b/recipes-bcm/kernel-image/bcm2835-mkimage/LICENCE new file mode 100644 index 0000000..c6849d9 --- /dev/null +++ b/recipes-bcm/kernel-image/bcm2835-mkimage/LICENCE | |||
@@ -0,0 +1,3 @@ | |||
1 | I believe this is a proprietary binary (the first32k.bin file) provided by Broadcom. | ||
2 | |||
3 | It is distributed with the express permission of the RaspberryPi foundation. | ||
diff --git a/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-args-uncompressed.txt b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-args-uncompressed.txt new file mode 100644 index 0000000..09398b4 --- /dev/null +++ b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-args-uncompressed.txt | |||
@@ -0,0 +1,12 @@ | |||
1 | ; kernel args (place at 0x00000100) | ||
2 | 0x00000005 | ||
3 | 0x54410001 | ||
4 | 0x00000001 | ||
5 | 0x00001000 | ||
6 | 0x00000000 | ||
7 | 0x00000004 | ||
8 | 0x54410002 | ||
9 | 0x08000000 | ||
10 | 0x00000000 | ||
11 | 0x00000000 | ||
12 | 0x00000000 | ||
diff --git a/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-boot-uncompressed.txt b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-boot-uncompressed.txt new file mode 100644 index 0000000..1cf5888 --- /dev/null +++ b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-boot-uncompressed.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | ; bootloader (place at 0x00000000) | ||
2 | 0xea000006 | ||
3 | 0xe1a00000 | ||
4 | 0xe1a00000 | ||
5 | 0xe1a00000 | ||
6 | 0xe1a00000 | ||
7 | 0xe1a00000 | ||
8 | 0xe1a00000 | ||
9 | 0xe1a00000 | ||
10 | |||
11 | 0xe3a00000 | ||
12 | 0xe3a01042 | ||
13 | 0xe3811c0c | ||
14 | 0xe59f2000 | ||
15 | 0xe59ff000 | ||
16 | 0x00000100 | ||
17 | 0x00008000 | ||
diff --git a/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-kernel-first32k.bin b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-kernel-first32k.bin new file mode 100644 index 0000000..ebf74be --- /dev/null +++ b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-kernel-first32k.bin | |||
Binary files differ | |||
diff --git a/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-mkimage.py b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-mkimage.py new file mode 100644 index 0000000..6ce9231 --- /dev/null +++ b/recipes-bcm/kernel-image/bcm2835-mkimage/bcm2835-mkimage.py | |||
@@ -0,0 +1,51 @@ | |||
1 | #!/usr/bin/python | ||
2 | |||
3 | import os | ||
4 | import re | ||
5 | import sys | ||
6 | |||
7 | try: | ||
8 | raw_kernel = sys.argv[1] | ||
9 | except: | ||
10 | raw_kernel = "./zImage" | ||
11 | |||
12 | try: | ||
13 | output_img = sys.argv[2] | ||
14 | except: | ||
15 | output_img = "./kernel.img" | ||
16 | |||
17 | try: | ||
18 | supfile_loc = sys.argv[3] | ||
19 | except: | ||
20 | supfile_loc = "./" | ||
21 | |||
22 | re_line = re.compile(r"0x(?P<value>[0-9a-f]{8})") | ||
23 | |||
24 | mem = [0 for i in range(32768)] | ||
25 | |||
26 | def load_to_mem(name, addr): | ||
27 | f = open(name) | ||
28 | |||
29 | for l in f.readlines(): | ||
30 | m = re_line.match(l) | ||
31 | |||
32 | if m: | ||
33 | value = int(m.group("value"), 16) | ||
34 | |||
35 | for i in range(4): | ||
36 | mem[addr] = int(value >> i * 8 & 0xff) | ||
37 | addr += 1 | ||
38 | |||
39 | f.close() | ||
40 | |||
41 | load_to_mem(""+supfile_loc+"bcm2835-boot-uncompressed.txt", 0x00000000) | ||
42 | load_to_mem(""+supfile_loc+"bcm2835-args-uncompressed.txt", 0x00000100) | ||
43 | |||
44 | f = open(""+supfile_loc+"bcm2835-kernel-first32k.bin", "wb") | ||
45 | |||
46 | for m in mem: | ||
47 | f.write(chr(m)) | ||
48 | |||
49 | f.close() | ||
50 | |||
51 | os.system("cat "+supfile_loc+"bcm2835-kernel-first32k.bin "+raw_kernel+" > "+output_img+"") | ||