linux-xlnx_4.0.bbappend 7.05 KB
Newer Older
1
FILESEXTRAPATHS_append := "${THISDIR}/linux-xlnx:"
2
FILESEXTRAPATHS_prepend := "${THISDIR}/config:"
3 4

SRC_URI_append += " file://xilinx_emacps.c.patch"
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
5
SRC_URI_append += " file://xilinx_uartps.c.patch"
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
6
SRC_URI_append += " file://si5338_vsc330x.patch"
Andrey Filippov's avatar
Andrey Filippov committed
7
SRC_URI_append += " file://drivers-elphel.patch"
8

9 10 11
SRC_URI_append += " file://${MACHINE}.scc"
KERNEL_FEATURES_append = " ${MACHINE}.scc"

12
linux-elphel_label= "git://github.com/Elphel/linux-elphel.git"
13 14
linux-elphel_branch= "master"
linux-elphel_gitdir= "${WORKDIR}/linux-elphel"
15

16
# To use the latest leave: "" - (=empty)
17 18
linux-elphel_srcrev= ""
#linux-elphel_srcrev= "0ca36687a400fd9a5c4510295ae5be88aac77fa4"
19 20
#

21 22
DEV_DIR ?= "${TOPDIR}/../../linux-elphel"

23
# set output for Eclipse project setup parser:
24
EXTRA_OEMAKE += "-s -w -B KCFLAGS='-v'"
25
# or use a variable:
26
export _MAKEFLAGS="-s -w -B KCFLAGS='-v'"
27
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE _MAKEFLAGS"
28
EXTRA_OEMAKE = "${_MAKEFLAGS}"
29

30 31 32 33
INITRAMFS_IMAGE = "core-image-elphel393-initramfs"
INITRAMFS_IMAGE_BUNDLE = "1"
#IMAGE_FSTYPES = "cpio.gz"

34
do_fetch_append() {
35 36 37 38 39 40 41
    DEV_DIR = d.getVar('DEV_DIR', True)
    linux_elphel_label  = d.getVar('linux-elphel_label', True)
    linux_elphel_branch = d.getVar('linux-elphel_branch', True)
    linux_elphel_gitdir = d.getVar('linux-elphel_gitdir', True)
    linux_elphel_srcrev = d.getVar('linux-elphel_srcrev', True)
    
    if os.path.isdir(DEV_DIR):
42 43
        print("Found DEV_DIR, skipping cloning")
    else:
44 45 46
        print("Cloninig "+linux-elphel_label+"\n")
        os.system("git clone -b "+linux_elphel_branch+" "+linux_elphel_label+" "+linux_elphel_gitdir)
        os.system("cd "+linux_elphel_gitdir+";git checkout "+linux_elphel_srcrev)
47 48
}

49
python do_link() {
50 51 52 53 54 55 56 57
    DEV_DIR = d.getVar('DEV_DIR', True)
    S = d.getVar('S', True)
    TOPDIR = d.getVar('TOPDIR', True)
    WORKDIR = d.getVar('WORKDIR', True)
    MACHINE = d.getVar('MACHINE', True)
    linux_elphel_gitdir = d.getVar('linux-elphel_gitdir', True)

    if os.path.isdir(DEV_DIR):
58
        print("DEV_DIR exists - creating links...")
59 60
        devdir_abspath = os.path.abspath(DEV_DIR+"/src")
        for path, folders, files in os.walk(DEV_DIR+"/src"):
61
            folders[:]=[fd for fd in folders if fd != ".git"]
62 63 64
            for folder in folders:
                folder_abspath = os.path.abspath(os.path.join(path, folder))
                folder_relpath = folder_abspath.replace(devdir_abspath+"/", '')
65
                os.system("cd "+S+";mkdir -p "+folder_relpath)
66 67 68
            for filename in files:
                file_abspath = os.path.abspath(os.path.join(path, filename))
                file_relpath = file_abspath.replace(devdir_abspath+"/", '')
69
                os.system("cd "+S+";ln -sf "+file_abspath+" "+file_relpath)
70
                    
71 72 73 74 75
        #os.system("cd "+DEV_DIR+"; ln -sf "+S+" linux")
        if not os.path.isdir(DEV_DIR+"/sysroots"):
                os.system("cd "+DEV_DIR+"; ln -sf "+TOPDIR+"/tmp/sysroots sysroots")
        if not os.path.isdir(DEV_DIR+"/linux"):
                os.system("cd "+DEV_DIR+"; ln -sf "+WORKDIR+"/linux-"+MACHINE+"-standard-build linux")
76
    else:
77 78
        print("Copying "+linux_elphel_gitdir+"/src/ over "+S+"\n")
        os.system("cp -rfv "+linux_elphel_gitdir+"/src/* "+S)
79
}
80

81 82
addtask do_link before do_kernel_configme after do_patch

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
83
do_deploy_append(){
84 85
    for RLOC in ${PRODUCTION_ROOT_LOCATION}; do
        if [ ! -d ${DEPLOY_DIR_IMAGE}/${RLOC} ]; then
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
86
            mkdir -p ${DEPLOY_DIR_IMAGE}/${RLOC}
87
        fi
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
88 89
        #if [ -f ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin ]; then
        if [ -f ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin ]; then
90 91 92
            if [ -f ${DEPLOY_DIR_IMAGE}/${RLOC}/${PRODUCTION_KERNEL} ]; then
                rm ${DEPLOY_DIR_IMAGE}/${RLOC}/${PRODUCTION_KERNEL}
            fi
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
93 94 95
            cp ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOY_DIR_IMAGE}/${RLOC}/${PRODUCTION_KERNEL}
        else
            echo "NOT 3 FOUND!"
96
        fi
97 98 99 100 101 102 103
        #copy initramfs image over initramfsless image
        if [ -f ${DEPLOYDIR}/${INITRAMFS_BASE_NAME}.bin ]; then
            if [ -f ${DEPLOY_DIR_IMAGE}/${RLOC}/${PRODUCTION_KERNEL} ]; then
                rm ${DEPLOY_DIR_IMAGE}/${RLOC}/${PRODUCTION_KERNEL}
            fi
            cp ${DEPLOYDIR}/${INITRAMFS_BASE_NAME}.bin ${DEPLOY_DIR_IMAGE}/${RLOC}/${PRODUCTION_KERNEL}
        fi
104
    done
105
}
106

107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
# Override do_bundle_initramfs (kernel.bbclass)
do_bundle_initramfs () {
	if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
		echo "Creating a kernel image with a bundled initramfs..."
		copy_initramfs
		#if [ -e ${KERNEL_OUTPUT} ] ; then
		#	mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak
		#fi
		#use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-$#{MACHINE}.cpio
		#kernel_do_compile
		cp ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
		#mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
		# Update install area
		echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT}.initramfs"
		install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs ${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin
		echo "${B}/${KERNEL_OUTPUT}.initramfs"
	fi
}

126 127 128 129
# Override kernel_do_compile used by do_bundle_initramfs in kernel.bbclass
# Added ${PARALLEL_MAKE} only
kernel_do_compile() {
	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
130
		
131 132 133 134 135 136 137
	# The $use_alternate_initrd is only set from
	# do_bundle_initramfs() This variable is specifically for the
	# case where we are making a second pass at the kernel
	# compilation and we want to force the kernel build to use a
	# different initramfs image.  The way to do that in the kernel
	# is to specify:
	# make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio
138 139
	if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] ; then
                echo "ONLY ONE RUN!"
140 141 142
		# The old style way of copying an prebuilt image and building it
		# is turned on via INTIRAMFS_TASK != ""
		copy_initramfs
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
143 144 145 146 147 148
		if [ ! -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio ] ; then
                    echo "This might be the very first kernel build (or deploy dir is empty) - initramfs is not there yet. Will have to compile kernel twice"
                    #oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${PARALLEL_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
                else
                    use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
                fi
149 150
        fi
        oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${PARALLEL_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
151 152 153 154
	if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then
		gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}"
	fi
}
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
155 156 157 158 159 160 161 162 163 164 165 166

do_install_append() {
    echo "installing headers to ${WORKDIR}/headers"
    make headers_install INSTALL_HDR_PATH="${WORKDIR}/headers"
}

#do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TARGET}-uapi/"

sysroot_stage_all_append() {
         sysroot_stage_dir ${WORKDIR}/headers/include ${STAGING_DIR_TARGET}/usr/include-uapi
}

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
167 168 169
## And you'd then use -I=/usr/myheaders/include to reference the sysroot
## copy of those headers.