1 # Copyright (C) 2007, Stelios Koroneos - Digital OPSiS, All Rights Reserved
2 # Copyright (C) 2010, Adrian Alonso <aalonso00@gmail.com>
3 # Released under the MIT license (see packages/COPYING)
5 #This class handles all the intricasies of getting the required files from the
6 #ISE/EDK/project to the kernel and prepare the kernel for compilation.
7 #The Xilinx EDK supports 2 different architectures : PowerPC (ppc 405,440) and Microblaze
8 #Only the PowerPC BSP has been tested so far
9 #For this to work correctly you need to add XILINX_BSP_PATH and XILINX_BOARD to your
11 #XILINX_BSP_PATH should have the complete path to your project dir
12 #XILINX_BOARD should have the board type i.e ML403
21 board = bb.data.getVar('XILINX_BOARD', d, 1)
22 cpu = bb.data.getVar('TARGET_CPU', d, 1)
24 if re.match('powerpc', a):
25 return 'ppc' + cpu + '-' + board
29 def uboot_machine(a, d):
32 board = bb.data.getVar('XILINX_BOARD', d, 1)
33 if board in ['ml300', 'ml401', 'ml403', 'ml405', 'ml507', 'ml510']:
34 if re.match('powerpc', a):
37 elif board == 'ml510':
40 return board + '_config'
42 return 'microblaze-generic_config'
44 def uboot_target(a, d):
47 board = bb.data.getVar('XILINX_BOARD', d, 1)
48 target = bb.data.getVar('TARGET_CPU', d, 1) + '-generic'
49 if board in ['ml300', 'ml401', 'ml403', 'ml405', 'ml507', 'ml510']:
50 if re.match('powerpc', a):
53 elif board == 'ml510':
60 do_configure_prepend() {
61 #first check that the XILINX_BSP_PATH and XILINX_BOARD have been defined in local.conf
62 #now depending on the board type and arch do what is nessesary
63 if [ -n "${XILINX_BSP_PATH}" ]; then
64 if [ -n "${XILINX_BOARD}" ]; then
65 if [ -d "${S}/arch/${TARGET_ARCH}/boot" ]; then
66 dts=`find "${XILINX_BSP_PATH}" -name *.dts -print`
67 if [ -e "$dts" ]; then
68 oenote "Replacing device tree to match hardware model"
69 if [ "${TARGET_ARCH}" = "powerpc" ]; then
70 cp -pP ${dts} ${S}/arch/powerpc/boot/dts/virtex${TARGET_BOARD}.dts
72 cp -pP ${dts} ${S}/arch/microblaze/platform/generic/${TARGET_BOARD}.dts
75 oefatal "No device tree found, missing hardware ref design?"
78 elif [ -d "${S}/board/xilinx" ]; then
79 oenote "Replacing xparameters header to match hardware model"
80 if [ "${TARGET_ARCH}" = "powerpc" ]; then
81 xparam="${XILINX_BSP_PATH}/ppc${TARGET_CPU}_0/include/xparameters.h"
82 cpu="PPC`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`"
84 xparam="${XILINX_BSP_PATH}/${TARGET_CPU}_0/include/xparameters.h"
85 cpu=`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`
87 if [ -e "$xparam" ]; then
88 cp ${xparam} ${S}/board/xilinx/${UBOOT_TARGET}
89 echo "/*** Cannonical definitions ***/
90 #define XPAR_PLB_CLOCK_FREQ_HZ XPAR_PROC_BUS_0_FREQ_HZ
91 #define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_${cpu}_CORE_CLOCK_FREQ_HZ
92 #ifndef XPAR_DDR2_SDRAM_MEM_BASEADDR
93 # define XPAR_DDR2_SDRAM_MEM_BASEADDR XPAR_DDR_SDRAM_MPMC_BASEADDR
95 #define XPAR_PCI_0_CLOCK_FREQ_HZ 0" >> ${S}/board/xilinx/${UBOOT_TARGET}/xparameters.h
97 oefatal "No xparameters header file found, missing hardware ref design?"
102 oefatal "XILINX_BOARD not defined ! Exit"
106 oefatal "XILINX_BSP_PATH not defined ! Exit"
111 do_deploy_prepend() {
112 # Install u-boot elf image
113 if [ -d "${XILINX_BSP_PATH}" ]; then
114 if [ -e "${S}/u-boot" ]; then
115 install ${S}/u-boot ${XILINX_BSP_PATH}