diff options
author | Nathan Rossi <nathan.rossi@xilinx.com> | 2015-04-21 13:31:08 +1000 |
---|---|---|
committer | Nathan Rossi <nathan.rossi@xilinx.com> | 2015-04-21 13:31:08 +1000 |
commit | 7d969dbea9999b16b332d46fa844a29577ff6f4e (patch) | |
tree | 13228e5e8e6dc2fae0f96785241568620315edd9 | |
parent | 108f0114615fd51f2acb1bc7d5bc84c563adefc6 (diff) | |
download | meta-xilinx-7d969dbea9999b16b332d46fa844a29577ff6f4e.tar.gz |
u-boot-extra.inc: Rework MicroBlaze config.mk generation
* Rework the config.mk for MicroBlaze into a seperate task
* Change to using a python task for better handling of content and
parsing of the xparameters file
Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
-rw-r--r-- | recipes-bsp/u-boot/u-boot-extra.inc | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/recipes-bsp/u-boot/u-boot-extra.inc b/recipes-bsp/u-boot/u-boot-extra.inc index b7569864..4301bb46 100644 --- a/recipes-bsp/u-boot/u-boot-extra.inc +++ b/recipes-bsp/u-boot/u-boot-extra.inc | |||
@@ -13,27 +13,40 @@ UBOOT_XPARAMETERS ?= "${@expand_workdir_paths("MACHINE_XPARAMETERS", d)}" | |||
13 | 13 | ||
14 | # Install the MicroBlaze System configuration into the board configuration, | 14 | # Install the MicroBlaze System configuration into the board configuration, |
15 | # and generate a u-boot specific config.mk | 15 | # and generate a u-boot specific config.mk |
16 | do_configure_prepend () { | 16 | python do_configmk_generate () { |
17 | if [ "${SOC_FAMILY}" = "microblaze" -a -e "${UBOOT_XPARAMETERS}" ]; then | 17 | import re, sys, os, shutil |
18 | CONFIG_MK=${S}/board/xilinx/microblaze-generic/config.mk | 18 | |
19 | cp ${UBOOT_XPARAMETERS} ${S}/board/xilinx/microblaze-generic/xparameters.h | 19 | machine_xparameters = d.getVar("UBOOT_XPARAMETERS", True) |
20 | 20 | ||
21 | # Generate the config.mk from CFLAGS and XPARAMETERS file | 21 | if d.getVar("SOC_FAMILY") == "microblaze" and machine_xparameters and os.path.exists(machine_xparameters): |
22 | echo "# This file is generated by the meta-xilinx layer." > ${CONFIG_MK} | 22 | boardpath = os.path.join("board", "xilinx", "microblaze-generic") |
23 | echo "" >> ${CONFIG_MK} | 23 | configmk = os.path.join(d.getVar("S", True), boardpath, "config.mk") |
24 | 24 | xparameters = os.path.join(d.getVar("S", True), boardpath, "xparameters.h") | |
25 | # Export CCARGS | 25 | |
26 | for i in ${TUNE_CCARGS}; do | 26 | shutil.copyfile(machine_xparameters, xparameters) |
27 | echo "PLATFORM_CPPFLAGS += $i" >> ${CONFIG_MK} | 27 | |
28 | done | 28 | # Search the xparameters.h file for the RAM base addr and size. |
29 | echo "" >> ${CONFIG_MK} | 29 | ram = None |
30 | 30 | with open(machine_xparameters, "r") as f: | |
31 | # Calculate the TEXT_BASE address at RAM_END - 4MB | 31 | filedata = f.read() |
32 | RAM_START=$(grep "XILINX_RAM_START" ${UBOOT_XPARAMETERS} | grep -o "0x.*$") | 32 | ramstart = re.search("XILINX_RAM_START.*?(0x.*)", filedata) |
33 | RAM_SIZE=$(grep "XILINX_RAM_SIZE" ${UBOOT_XPARAMETERS} | grep -o "0x.*$") | 33 | ramsize = re.search("XILINX_RAM_SIZE.*?(0x.*)", filedata) |
34 | BASE_OFFSET=$(printf "0x%08x" "$[$RAM_START + $RAM_SIZE - 0x400000]") | 34 | if ramstart and ramsize: |
35 | 35 | ram = (int(ramstart.group(1), 16), int(ramsize.group(1), 16)) | |
36 | echo "TEXT_BASE = $BASE_OFFSET" >> ${CONFIG_MK} | 36 | |
37 | echo "CONFIG_SYS_TEXT_BASE = $BASE_OFFSET" >> ${CONFIG_MK} | 37 | # build up the config.mk file from known info |
38 | fi | 38 | with open(configmk, "wb") as f: |
39 | f.write("# This file is generated by the meta-xilinx layers.\n") | ||
40 | f.write("\n") | ||
41 | |||
42 | for i in d.getVar("TUNE_CCARGS", True).split(): | ||
43 | f.write("PLATFORM_CCPFLAGS += %s\n" % i) | ||
44 | f.write("\n") | ||
45 | |||
46 | if ram != None: | ||
47 | base_offset = ram[0] + ram[1] - 0x400000 | ||
48 | f.write("TEXT_BASE = 0x%x\n" % base_offset) | ||
49 | f.write("CONFIG_SYS_TEXT_BASE = 0x%x\n" % base_offset) | ||
39 | } | 50 | } |
51 | addtask configmk_generate before do_configure after do_unpack | ||
52 | |||