summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2013-05-08 13:43:57 +1000
committerNathan Rossi <nathan.rossi@xilinx.com>2013-05-08 13:43:57 +1000
commit3c33e655e878b04a5e7452a85376642c2f3e486a (patch)
tree16672e1e6ad8f6a5172d4813e9a3231489d1e9d9
parent4c669faa887c1300551ac5ff34d460839081a0cb (diff)
downloadmeta-xilinx-3c33e655e878b04a5e7452a85376642c2f3e486a.tar.gz
linux-xlnx: Add microblaze support and patches
* Include the soc-family.inc for SOC conditional variable use * Add microblaze patches Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
-rw-r--r--recipes-kernel/linux/linux-xlnx.inc39
-rw-r--r--recipes-kernel/linux/linux-xlnx/microblaze_Do_not_use_r6_in_head.S.patch69
-rw-r--r--recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch68
-rw-r--r--recipes-kernel/linux/linux-xlnx/microblaze_Fix_initrd_support.patch52
-rw-r--r--recipes-kernel/linux/linux-xlnx_3.8.bb15
5 files changed, 202 insertions, 41 deletions
diff --git a/recipes-kernel/linux/linux-xlnx.inc b/recipes-kernel/linux/linux-xlnx.inc
index 7b2319be..3528edaf 100644
--- a/recipes-kernel/linux/linux-xlnx.inc
+++ b/recipes-kernel/linux/linux-xlnx.inc
@@ -1,48 +1,19 @@
1#
2# To use linux-xlnx in your layer, create a
3# linux-yocto-xlnx.bbappend file containing at least the following
4# lines:
5#
6# FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
7# COMPATIBLE_MACHINE_yourmachine = "yourmachine"
8#
9# You must also provide a Linux kernel configuration. The most direct
10# method is to copy your .config to files/defconfig in your layer,
11# in the same directory as the bbappend and add file://defconfig to
12# your SRC_URI.
13#
14#
15# Notes:
16#
17# patches: patches can be merged into to the source git tree itself,
18# added via the SRC_URI, or controlled via a BSP
19# configuration.
20#
21# example configuration addition:
22# SRC_URI += "file://smp.cfg"
23# example patch addition (for kernel v3.4 only):
24# SRC_URI += "file://0001-linux-version-tweak.patch
25# example feature addition (for kernel v3.4 only):
26# SRC_URI += "file://feature.scc"
27#
28
29inherit kernel 1inherit kernel
30 2
31# This version extension should match CONFIG_LOCALVERSION in defconfig 3# This version extension should match CONFIG_LOCALVERSION in defconfig
32LINUX_VERSION_EXTENSION ?= "-xilinx" 4LINUX_VERSION_EXTENSION ?= "-xilinx"
33 5
34require recipes-kernel/linux/linux-yocto.inc 6require recipes-kernel/linux/linux-yocto.inc
7require conf/machine/include/soc-family.inc
35 8
36FILESEXTRAPATHS_prepend := "${THISDIR}/linux-xlnx:" 9# MicroBlaze is a uImage target, but its not called 'uImage'
10DEPENDS_microblaze += "u-boot-mkimage-native"
37 11
38# Override SRC_URI in a bbappend file to point at a different source 12FILESEXTRAPATHS_prepend := "${THISDIR}/linux-xlnx:"
39# tree if you do not want to build from Linus' tree.
40SRC_URI = "git://github.com/Xilinx/linux-xlnx;protocol=git;nocheckout=1" 13SRC_URI = "git://github.com/Xilinx/linux-xlnx;protocol=git;nocheckout=1"
41 14
42PR = "r1" 15PR = "r1"
43PV = "${LINUX_VERSION}${LINUX_VERSION_EXTENSION}+git${SRCPV}" 16PV = "${LINUX_VERSION}${LINUX_VERSION_EXTENSION}+git${SRCPV}"
44 17
45# Override COMPATIBLE_MACHINE to include your machine in a bbappend 18# Override COMPATIBLE_MACHINE to include your machine in a bbappend file.
46# file.
47COMPATIBLE_MACHINE = "zynq|microblazeel" 19COMPATIBLE_MACHINE = "zynq|microblazeel"
48
diff --git a/recipes-kernel/linux/linux-xlnx/microblaze_Do_not_use_r6_in_head.S.patch b/recipes-kernel/linux/linux-xlnx/microblaze_Do_not_use_r6_in_head.S.patch
new file mode 100644
index 00000000..abed47cc
--- /dev/null
+++ b/recipes-kernel/linux/linux-xlnx/microblaze_Do_not_use_r6_in_head.S.patch
@@ -0,0 +1,69 @@
1From: Michal Simek <michal.simek@xilinx.com>
2Subject: [LINUX PATCH 1/3] microblaze: Do not use r6 in head.S
3
4r6 stores pointer to ramdisk and shouldn't
5be used before it is passed to machine_early_init.
6
7Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8---
9 arch/microblaze/kernel/head.S | 20 ++++++++++----------
10 1 file changed, 10 insertions(+), 10 deletions(-)
11
12diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
13index eef84de..a8ce682 100644
14--- a/arch/microblaze/kernel/head.S
15+++ b/arch/microblaze/kernel/head.S
16@@ -112,16 +112,16 @@ no_fdt_arg:
17 * copy command line directly to cmd_line placed in data section.
18 */
19 beqid r5, skip /* Skip if NULL pointer */
20- or r6, r0, r0 /* incremment */
21+ or r11, r0, r0 /* incremment */
22 ori r4, r0, cmd_line /* load address of command line */
23 tophys(r4,r4) /* convert to phys address */
24 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */
25 _copy_command_line:
26 /* r2=r5+r6 - r5 contain pointer to command line */
27- lbu r2, r5, r6
28+ lbu r2, r5, r11
29 beqid r2, skip /* Skip if no data */
30- sb r2, r4, r6 /* addr[r4+r6]= r2*/
31- addik r6, r6, 1 /* increment counting */
32+ sb r2, r4, r11 /* addr[r4+r6]= r2*/
33+ addik r11, r11, 1 /* increment counting */
34 bgtid r3, _copy_command_line /* loop for all entries */
35 addik r3, r3, -1 /* decrement loop */
36 addik r5, r4, 0 /* add new space for command line */
37@@ -131,13 +131,13 @@ skip:
38
39 #ifdef NOT_COMPILE
40 /* save bram context */
41- or r6, r0, r0 /* incremment */
42+ or r11, r0, r0 /* incremment */
43 ori r4, r0, TOPHYS(_bram_load_start) /* save bram context */
44 ori r3, r0, (LMB_SIZE - 4)
45 _copy_bram:
46- lw r7, r0, r6 /* r7 = r0 + r6 */
47- sw r7, r4, r6 /* addr[r4 + r6] = r7*/
48- addik r6, r6, 4 /* increment counting */
49+ lw r7, r0, r11 /* r7 = r0 + r6 */
50+ sw r7, r4, r11 /* addr[r4 + r6] = r7*/
51+ addik r11, r11, 4 /* increment counting */
52 bgtid r3, _copy_bram /* loop for all entries */
53 addik r3, r3, -4 /* descrement loop */
54 #endif
55@@ -303,8 +303,8 @@ jump_over2:
56 * the exception vectors, using a 4k real==virtual mapping.
57 */
58 /* Use temporary TLB_ID for LMB - clear this temporary mapping later */
59- ori r6, r0, MICROBLAZE_LMB_TLB_ID
60- mts rtlbx,r6
61+ ori r11, r0, MICROBLAZE_LMB_TLB_ID
62+ mts rtlbx,r11
63
64 ori r4,r0,(TLB_WR | TLB_EX)
65 ori r3,r0,(TLB_VALID | TLB_PAGESZ(PAGESZ_4K))
66--
671.8.2.1
68
69
diff --git a/recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch b/recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch
new file mode 100644
index 00000000..c32f8809
--- /dev/null
+++ b/recipes-kernel/linux/linux-xlnx/microblaze_Fix_free_init_pages_function.patch
@@ -0,0 +1,68 @@
1From: Michal Simek <michal.simek@xilinx.com>
2Subject: [LINUX PATCH 2/3] microblaze: Fix free_init_pages function
3
4- fce() is used only in init.c file - let's use static
5- start and end addresses should be page align
6- remove additional addr variable
7- use pr_info instead of printk(KERN_INFO...)
8- use __free_page(page) instead of free_page(start)
9 it is faster because of no checking,
10 if ramdisk is out of the kernel you will get kernel panic anyway
11
12Signed-off-by: Michal Simek <michal.simek@xilinx.com>
13---
14 arch/microblaze/include/asm/setup.h | 1 -
15 arch/microblaze/mm/init.c | 20 +++++++++++++-------
16 2 files changed, 13 insertions(+), 8 deletions(-)
17
18diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
19index 0e0b0a5..f05df56 100644
20--- a/arch/microblaze/include/asm/setup.h
21+++ b/arch/microblaze/include/asm/setup.h
22@@ -46,7 +46,6 @@ void machine_shutdown(void);
23 void machine_halt(void);
24 void machine_power_off(void);
25
26-void free_init_pages(char *what, unsigned long begin, unsigned long end);
27 extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
28 extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
29
30diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
31index ce80823..09affec 100644
32--- a/arch/microblaze/mm/init.c
33+++ b/arch/microblaze/mm/init.c
34@@ -236,17 +236,23 @@ void __init setup_memory(void)
35 paging_init();
36 }
37
38-void free_init_pages(char *what, unsigned long begin, unsigned long end)
39+static void free_init_pages(char *what, unsigned long start, unsigned long end)
40 {
41- unsigned long addr;
42+ if (start >= end)
43+ return;
44
45- for (addr = begin; addr < end; addr += PAGE_SIZE) {
46- ClearPageReserved(virt_to_page(addr));
47- init_page_count(virt_to_page(addr));
48- free_page(addr);
49+ start = PAGE_DOWN(start);
50+ end = PAGE_UP(end);
51+
52+ pr_info("Freeing %s: %ldk freed\n", what, (end - start) >> 10);
53+
54+ for (; start < end; start += PAGE_SIZE) {
55+ struct page *page = virt_to_page(start);
56+ ClearPageReserved(page);
57+ init_page_count(page);
58+ __free_page(page);
59 totalram_pages++;
60 }
61- printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
62 }
63
64 #ifdef CONFIG_BLK_DEV_INITRD
65--
661.8.2.1
67
68
diff --git a/recipes-kernel/linux/linux-xlnx/microblaze_Fix_initrd_support.patch b/recipes-kernel/linux/linux-xlnx/microblaze_Fix_initrd_support.patch
new file mode 100644
index 00000000..7c4b6f76
--- /dev/null
+++ b/recipes-kernel/linux/linux-xlnx/microblaze_Fix_initrd_support.patch
@@ -0,0 +1,52 @@
1From: Michal Simek <michal.simek@xilinx.com>
2Subject: [LINUX PATCH 3/3] microblaze: Fix initrd support
3
4Initrd/ramdisk support has been never validated.
5
6Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7---
8 arch/microblaze/mm/init.c | 20 ++++++--------------
9 1 file changed, 6 insertions(+), 14 deletions(-)
10
11diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
12index 09affec..f394ad8 100644
13--- a/arch/microblaze/mm/init.c
14+++ b/arch/microblaze/mm/init.c
15@@ -258,16 +258,7 @@ static void free_init_pages(char *what, unsigned long start, unsigned long end)
16 #ifdef CONFIG_BLK_DEV_INITRD
17 void free_initrd_mem(unsigned long start, unsigned long end)
18 {
19- int pages = 0;
20- for (; start < end; start += PAGE_SIZE) {
21- ClearPageReserved(virt_to_page(start));
22- init_page_count(virt_to_page(start));
23- free_page(start);
24- totalram_pages++;
25- pages++;
26- }
27- printk(KERN_NOTICE "Freeing initrd memory: %dk freed\n",
28- (int)(pages * (PAGE_SIZE / 1024)));
29+ free_init_pages("initrd memory", start, end);
30 }
31 #endif
32
33@@ -438,10 +429,11 @@ asmlinkage void __init mmu_init(void)
34
35 #if defined(CONFIG_BLK_DEV_INITRD)
36 /* Remove the init RAM disk from the available memory. */
37-/* if (initrd_start) {
38- mem_pieces_remove(&phys_avail, __pa(initrd_start),
39- initrd_end - initrd_start, 1);
40- }*/
41+ if (initrd_start) {
42+ unsigned long size;
43+ size = initrd_end - initrd_start;
44+ memblock_reserve(virt_to_phys(initrd_start), size);
45+ }
46 #endif /* CONFIG_BLK_DEV_INITRD */
47
48 /* Initialize the MMU hardware */
49--
501.8.2.1
51
52
diff --git a/recipes-kernel/linux/linux-xlnx_3.8.bb b/recipes-kernel/linux/linux-xlnx_3.8.bb
index 0d6fc448..bdcc47a7 100644
--- a/recipes-kernel/linux/linux-xlnx_3.8.bb
+++ b/recipes-kernel/linux/linux-xlnx_3.8.bb
@@ -1,12 +1,13 @@
1# See include file for common information 1# See include file for common information
2include linux-xlnx.inc 2include linux-xlnx.inc
3 3
4# Kernel version and SRCREV correspond to: 4# Kernel version and SRCREV correspond to: github.com/Xilinx v14.5 tag
5# github.com/Xilinx v14.5 tag
6# If required for a custom layer:
7# Override SRCREV to point to a different commit in a bbappend file to
8# Or add patches as required
9
10# This version doesn't build in Poky 1.3, patch required http://patches.openembedded.org/patch/38283/
11LINUX_VERSION = "3.8" 5LINUX_VERSION = "3.8"
12SRCREV = "6a0bedad60e2bca8d9b50bf81b9895e29e31a6d7" 6SRCREV = "6a0bedad60e2bca8d9b50bf81b9895e29e31a6d7"
7
8# MicroBlaze patches
9SRC_URI_append = " \
10 file://microblaze_Do_not_use_r6_in_head.S.patch \
11 file://microblaze_Fix_free_init_pages_function.patch \
12 file://microblaze_Fix_initrd_support.patch \
13 "