From a235865ed1aeb83aa87ff7dc8a973de1f9feb044 Mon Sep 17 00:00:00 2001 From: Robert Nelson <robertcnelson@gmail.com> Date: Wed, 7 Dec 2016 16:46:18 -0600 Subject: [PATCH] sgx: add wip, does not build (this is a port of v4.4.x-bone) Signed-off-by: Robert Nelson <robertcnelson@gmail.com> --- 3rdparty/sgx-install.sh | 146 +++++++++ 3rdparty/sgx-startup-sysv.sh | 52 ++++ patch.sh | 1 + ...drm-fb_helper-enable-panning-support.patch | 51 ++++ ...add-vsync-callback-for-use-in-omaplf.patch | 95 ++++++ ...ata-quirks-for-sgx-deassert_hardrese.patch | 86 ++++++ ...4-ARM-dts-am33xx-add-DT-node-for-gpu.patch | 34 +++ ...reduce-visibility-of-dmac_-functions.patch | 104 +++++++ ...-flush-management-symbols-when-MULTI.patch | 34 +++ sgx_build_modules.sh | 285 ++++++++++++++++++ sgx_create_package.sh | 285 ++++++++++++++++++ 11 files changed, 1173 insertions(+) create mode 100644 3rdparty/sgx-install.sh create mode 100644 3rdparty/sgx-startup-sysv.sh create mode 100644 patches/drivers/ti/sgx/0001-HACK-drm-fb_helper-enable-panning-support.patch create mode 100644 patches/drivers/ti/sgx/0002-HACK-drm-tilcdc-add-vsync-callback-for-use-in-omaplf.patch create mode 100644 patches/drivers/ti/sgx/0003-ARM-OMAP2-Use-pdata-quirks-for-sgx-deassert_hardrese.patch create mode 100644 patches/drivers/ti/sgx/0004-ARM-dts-am33xx-add-DT-node-for-gpu.patch create mode 100644 patches/drivers/ti/sgx/0005-Revert-ARM-reduce-visibility-of-dmac_-functions.patch create mode 100644 patches/drivers/ti/sgx/0006-arm-Export-cache-flush-management-symbols-when-MULTI.patch create mode 100755 sgx_build_modules.sh create mode 100755 sgx_create_package.sh diff --git a/3rdparty/sgx-install.sh b/3rdparty/sgx-install.sh new file mode 100644 index 000000000..81246ce3d --- /dev/null +++ b/3rdparty/sgx-install.sh @@ -0,0 +1,146 @@ +#!/bin/sh -e + +if ! id | grep -q root; then + echo "must be run as root" + exit +fi + +install_lib_n_system () { + if [ -f ${libdir}/${file} ] ; then + cp -v ${libdir}/${file} /usr/lib/${file} + if [ -d /usr/lib/arm-linux-gnueabihf/ ] ; then + cp -v ${libdir}/${file} /usr/lib/arm-linux-gnueabihf/${file} + fi + fi +} + +install_lib () { + if [ -f ${libdir}/${file} ] ; then + cp -v ${libdir}/${file} /usr/lib/${file} + fi +} + +install_bin () { + if [ -f ${libdir}/${file} ] ; then + cp -v ${libdir}/${file} /usr/local/bin/${file} + fi +} + +distro=$(lsb_release -si) + +if [ ! -f /lib/modules/`uname -r`/extra/es8.x/pvrsrvkm.ko ] ; then + if [ -f /opt/gfxmodules/gfx_rel_es8.x/pvrsrvkm.ko ] ; then + if [ ! -d /lib/modules/$(uname -r)/extra/ ] ; then + mkdir -p /lib/modules/$(uname -r)/extra/ || true + fi + + cp -v /opt/gfxmodules/gfx_rel_es8.x/pvrsrvkm.ko /lib/modules/$(uname -r)/extra/pvrsrvkm.ko + cp -v /opt/gfxmodules/gfx_rel_es8.x/omaplfb.ko /lib/modules/$(uname -r)/extra/omaplfb.ko + fi +fi + +echo "Running [depmod -a `uname -r`]" +depmod -a `uname -r` + +if [ -d /opt/gfxlibraries/gfx_rel_es8.x/ ] ; then + echo "Copying libraries" + libdir="/opt/gfxlibraries/gfx_rel_es8.x" + + # Install the standard libraries + # + file="libGLES_CM.so" ; install_lib + + file="libusc.so" ; install_lib + + file="libGLESv2.so" ; install_lib_n_system + + file="libglslcompiler.so" ; install_lib + + file="libIMGegl.so" ; install_lib + file="libEGL.so" ; install_lib_n_system + file="libpvr2d.so" ; install_lib + + file="libpvrPVR2D_BLITWSEGL.so" ; install_lib + file="libpvrPVR2D_FLIPWSEGL.so" ; install_lib + file="libpvrPVR2D_FRONTWSEGL.so" ; install_lib + file="libpvrPVR2D_LINUXFBWSEGL.so" ; install_lib + + file="libpvrEWS_WSEGL.so" ; install_lib + file="libpvrEWS_REMWSEGL.so" ; install_lib + + file="libsrv_um.so" ; install_lib + file="libsrv_init.so" ; install_lib + file="libPVRScopeServices.so" ; install_lib + + file="libews.so" ; install_lib + + # Install the standard executables + # + file="pvrsrvctl" ; install_bin + file="sgx_init_test" ; install_bin + + file="ews_server" ; install_bin + file="ews_server_es2" ; install_bin + + # Install the standard unittests + # + + file="services_test" ; install_bin + file="sgx_blit_test" ; install_bin + file="sgx_clipblit_test" ; install_bin + file="sgx_flip_test" ; install_bin + file="sgx_render_flip_test" ; install_bin + file="pvr2d_test" ; install_bin + + file="gles1test1" ; install_bin + file="gles1_texture_stream" ; install_bin + + file="gles2test1" ; install_bin + file="glsltest1_vertshader.txt" ; install_bin + file="glsltest1_fragshaderA.txt" ; install_bin + file="glsltest1_fragshaderB.txt" ; install_bin + file="gles2_texture_stream" ; install_bin + file="eglinfo" ; install_bin + + file="ews_test_gles1" ; install_bin + file="ews_test_gles1_egl_image_external" ; install_bin + + file="ews_test_gles2" ; install_bin + file="ews_test_gles2_main.vert" ; install_bin + file="ews_test_gles2_main.frag" ; install_bin + file="ews_test_gles2_pp.vert" ; install_bin + file="ews_test_gles2_pp.frag" ; install_bin + file="ews_test_gles2_egl_image_external" ; install_bin + file="ews_test_gles2_egl_image_external.vert" ; install_bin + file="ews_test_gles2_egl_image_external.frag" ; install_bin + file="ews_test_swrender" ; install_bin +fi + +case "${distro}" in +Debian) + if [ -f /opt/gfxinstall/scripts/sgx-startup-sysv.sh ] ; then + if [ -f /etc/init.d/sgx-startup.sh ] ; then + insserv --remove sgx-startup.sh + rm -rf /etc/init.d/sgx-startup.sh || true + fi + + cp -v /opt/gfxinstall/scripts/sgx-startup-sysv.sh /etc/init.d/sgx-startup.sh + chown root:root /etc/init.d/sgx-startup.sh + chmod +x /etc/init.d/sgx-startup.sh + insserv sgx-startup.sh || true + fi + ;; +Ubuntu) + if [ -f /opt/gfxinstall/scripts/sgx-startup-sysv.sh ] ; then + if [ -f /etc/init.d/sgx-startup.sh ] ; then + rm -rf /etc/init.d/sgx-startup.sh || true + update-rc.d sgx-startup.sh remove + fi + + cp -v /opt/gfxinstall/scripts/sgx-startup-sysv.sh /etc/init.d/sgx-startup.sh + chown root:root /etc/init.d/sgx-startup.sh + chmod +x /etc/init.d/sgx-startup.sh + update-rc.d sgx-startup.sh defaults + fi + ;; +esac diff --git a/3rdparty/sgx-startup-sysv.sh b/3rdparty/sgx-startup-sysv.sh new file mode 100644 index 000000000..70bc92acb --- /dev/null +++ b/3rdparty/sgx-startup-sysv.sh @@ -0,0 +1,52 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: sgx-startup.sh +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +case "$1" in +start) + if [ -d /sys/devices/ocp*/56000000.sgx ] || [ -d /sys/devices/platform/ocp/56000000.sgx ] ; then + echo "sgx: Starting PVR" + + modprobe -q pvrsrvkm + + # Delete the device for PVR services device and recreate with the + # correct major number. + # + pvr_maj=$(grep "pvrsrvkm$" /proc/devices | cut -b1,2,3) + + if [ -e /dev/pvrsrvkm ] ; then + rm -f /dev/pvrsrvkm + fi + + mknod /dev/pvrsrvkm c $pvr_maj 0 + chmod 666 /dev/pvrsrvkm + + if [ -f /usr/local/bin/pvrsrvctl ] ; then + /usr/local/bin/pvrsrvctl --start --no-module + + modprobe -q omaplfb + fi + fi + ;; +reload|force-reload|restart) + if [ -d /sys/devices/ocp*/56000000.sgx ] || [ -d /sys/devices/platform/ocp/56000000.sgx ] ; then + echo "sgx: Restarting PVR" + fi + ;; +stop) + exit 0 + ;; +*) + echo "Usage: /etc/init.d/sgx-startup.sh {start|stop|reload|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/patch.sh b/patch.sh index 94411f48a..81f962a59 100644 --- a/patch.sh +++ b/patch.sh @@ -583,6 +583,7 @@ drivers soc beaglebone dir 'build/gcc' +#dir 'drivers/ti/sgx' packaging () { echo "dir: packaging" diff --git a/patches/drivers/ti/sgx/0001-HACK-drm-fb_helper-enable-panning-support.patch b/patches/drivers/ti/sgx/0001-HACK-drm-fb_helper-enable-panning-support.patch new file mode 100644 index 000000000..5930beba5 --- /dev/null +++ b/patches/drivers/ti/sgx/0001-HACK-drm-fb_helper-enable-panning-support.patch @@ -0,0 +1,51 @@ +From 2e65df6fb029057b8e2f6981291c3b683c8663c0 Mon Sep 17 00:00:00 2001 +From: Darren Etheridge <detheridge@ti.com> +Date: Thu, 24 Jul 2014 11:49:28 -0500 +Subject: [PATCH 1/6] HACK: drm/fb_helper: enable panning support + +Increase the size of the buffer that is created in the fbdev emulation +helpers. And fill in the var structure with the amount that was allocated. + +Signed-off-by: Darren Etheridge <detheridge@ti.com> +--- + drivers/gpu/drm/drm_fb_cma_helper.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c +index 1fd6eac..843163e 100644 +--- a/drivers/gpu/drm/drm_fb_cma_helper.c ++++ b/drivers/gpu/drm/drm_fb_cma_helper.c +@@ -28,6 +28,12 @@ + + #define DEFAULT_FBDEFIO_DELAY_MS 50 + ++/* ++ * number of buffers to allocate from CMA pool, often increased for ++ * double/triple buffering ++ */ ++#define DRM_NUM_FBDEV_BUFFERS 3 ++ + struct drm_fb_cma { + struct drm_framebuffer fb; + struct drm_gem_cma_object *obj[4]; +@@ -403,7 +409,7 @@ int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper, + bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8); + + mode_cmd.width = sizes->surface_width; +- mode_cmd.height = sizes->surface_height; ++ mode_cmd.height = sizes->surface_height * DRM_NUM_FBDEV_BUFFERS; + mode_cmd.pitches[0] = sizes->surface_width * bytes_per_pixel; + mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, + sizes->surface_depth); +@@ -434,7 +440,7 @@ int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper, + fbi->fbops = &drm_fbdev_cma_ops; + + drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth); +- drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height); ++ drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->surface_height); + + offset = fbi->var.xoffset * bytes_per_pixel; + offset += fbi->var.yoffset * fb->pitches[0]; +-- +2.10.2 + diff --git a/patches/drivers/ti/sgx/0002-HACK-drm-tilcdc-add-vsync-callback-for-use-in-omaplf.patch b/patches/drivers/ti/sgx/0002-HACK-drm-tilcdc-add-vsync-callback-for-use-in-omaplf.patch new file mode 100644 index 000000000..29901ae51 --- /dev/null +++ b/patches/drivers/ti/sgx/0002-HACK-drm-tilcdc-add-vsync-callback-for-use-in-omaplf.patch @@ -0,0 +1,95 @@ +From 954e7d5791ff176f3b046575a8465c880d4eb536 Mon Sep 17 00:00:00 2001 +From: Darren Etheridge <detheridge@ti.com> +Date: Fri, 11 Jul 2014 09:15:25 -0500 +Subject: [PATCH 2/6] HACK: drm/tilcdc: add vsync callback for use in omaplfb + for gpu + +Add a vsync callback registration API that is identical to what was done +for da8xx-fb.c. + +Need to find if there is a better way using the DRM infrastructure from +kernel space. Either that or change the userspace window manager stuff in +the gpu libraries to make use of the DRM provided syncronization +mechanisms. + +Signed-off-by: Darren Etheridge <detheridge@ti.com> +--- + drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 33 +++++++++++++++++++++++++++++++++ + drivers/gpu/drm/tilcdc/tilcdc_drv.h | 5 +++++ + 2 files changed, 38 insertions(+) + +diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +index 52ebe8f..062c4d7 100644 +--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c ++++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +@@ -54,6 +54,10 @@ struct tilcdc_crtc { + int sync_lost_count; + bool frame_intact; + }; ++ ++static vsync_callback_t vsync_cb_handler; ++static void *vsync_cb_arg; ++ + #define to_tilcdc_crtc(x) container_of(x, struct tilcdc_crtc, base) + + static void unref_worker(struct drm_flip_work *work, void *val) +@@ -703,6 +707,32 @@ void tilcdc_crtc_update_clk(struct drm_crtc *crtc) + + #define SYNC_LOST_COUNT_LIMIT 50 + ++int register_vsync_cb(vsync_callback_t handler, void *arg, int idx) ++{ ++ if ((vsync_cb_handler == NULL) && (vsync_cb_arg == NULL)) { ++ vsync_cb_arg = arg; ++ vsync_cb_handler = handler; ++ } else { ++ return -EEXIST; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(register_vsync_cb); ++ ++int unregister_vsync_cb(vsync_callback_t handler, void *arg, int idx) ++{ ++ if ((vsync_cb_handler == handler) && (vsync_cb_arg == arg)) { ++ vsync_cb_handler = NULL; ++ vsync_cb_arg = NULL; ++ } else { ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(unregister_vsync_cb); ++ + irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc) + { + struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc); +@@ -746,6 +776,9 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc) + if (event) + drm_crtc_send_vblank_event(crtc, event); + ++ if (vsync_cb_handler) ++ vsync_cb_handler(vsync_cb_arg); ++ + spin_unlock_irqrestore(&dev->event_lock, flags); + } + +diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h +index 9780c37..3c62b3a 100644 +--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h ++++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h +@@ -179,4 +179,9 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc, + + int tilcdc_plane_init(struct drm_device *dev, struct drm_plane *plane); + ++/* used by SGX OMAPLFB drvier */ ++typedef void (*vsync_callback_t)(void *arg); ++int register_vsync_cb(vsync_callback_t handler, void *arg, int idx); ++int unregister_vsync_cb(vsync_callback_t handler, void *arg, int idx); ++ + #endif /* __TILCDC_DRV_H__ */ +-- +2.10.2 + diff --git a/patches/drivers/ti/sgx/0003-ARM-OMAP2-Use-pdata-quirks-for-sgx-deassert_hardrese.patch b/patches/drivers/ti/sgx/0003-ARM-OMAP2-Use-pdata-quirks-for-sgx-deassert_hardrese.patch new file mode 100644 index 000000000..05ccdfb30 --- /dev/null +++ b/patches/drivers/ti/sgx/0003-ARM-OMAP2-Use-pdata-quirks-for-sgx-deassert_hardrese.patch @@ -0,0 +1,86 @@ +From 3f25636595e55d60bcbeb379c06b13969a2721dd Mon Sep 17 00:00:00 2001 +From: Darren Etheridge <detheridge@ti.com> +Date: Fri, 25 Jul 2014 16:09:53 -0500 +Subject: [PATCH 3/6] ARM: OMAP2+: Use pdata-quirks for sgx deassert_hardreset + +Use pdata_quirks to provide platform data to the sgx driver. +The data that is provided includes: + +1) Function pointers for the driver to use to reset the h/w block. +2) The reset name that matches with what is used in hwmod. + +Signed-off-by: Darren Etheridge <detheridge@ti.com> +--- + arch/arm/mach-omap2/pdata-quirks.c | 12 ++++++++++++ + include/linux/platform_data/sgx-omap.h | 22 ++++++++++++++++++++++ + 2 files changed, 34 insertions(+) + create mode 100644 include/linux/platform_data/sgx-omap.h + +diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c +index 05e20aa..964598f6 100644 +--- a/arch/arm/mach-omap2/pdata-quirks.c ++++ b/arch/arm/mach-omap2/pdata-quirks.c +@@ -25,6 +25,7 @@ + #include <linux/platform_data/iommu-omap.h> + #include <linux/platform_data/wkup_m3.h> + #include <linux/platform_data/pwm_omap_dmtimer.h> ++#include <linux/platform_data/sgx-omap.h> + #include <linux/platform_data/media/ir-rx51.h> + #include <linux/platform_data/asoc-ti-mcbsp.h> + #include <plat/dmtimer.h> +@@ -49,6 +50,13 @@ struct pdata_init { + static struct of_dev_auxdata omap_auxdata_lookup[]; + static struct twl4030_gpio_platform_data twl_gpio_auxdata; + ++#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) ++static struct gfx_sgx_platform_data gfx_pdata = { ++ .reset_name = "gfx", ++ .deassert_reset = omap_device_deassert_hardreset, ++}; ++#endif ++ + #ifdef CONFIG_MACH_NOKIA_N8X0 + static void __init omap2420_n8x0_legacy_init(void) + { +@@ -553,6 +561,10 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { + OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3", + &wkup_m3_data), + #endif ++#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) ++ OF_DEV_AUXDATA("ti,sgx", 0x56000000, "56000000.sgx", ++ &gfx_pdata), ++#endif + #if IS_ENABLED(CONFIG_OMAP_DM_TIMER) + OF_DEV_AUXDATA("ti,omap-dmtimer-pwm", 0, NULL, &pwm_dmtimer_pdata), + #endif +diff --git a/include/linux/platform_data/sgx-omap.h b/include/linux/platform_data/sgx-omap.h +new file mode 100644 +index 0000000..aa59b2c +--- /dev/null ++++ b/include/linux/platform_data/sgx-omap.h +@@ -0,0 +1,22 @@ ++/* ++ * SGX Graphics Driver Platform Data ++ * ++ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ ++ * Darren Etheridge <detheridge@ti.com> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed "as is" WITHOUT ANY WARRANTY of any ++ * kind, whether express or implied; without even the implied warranty ++ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++#include <linux/platform_device.h> ++ ++struct gfx_sgx_platform_data { ++ const char *reset_name; ++ ++ int (*deassert_reset)(struct platform_device *pdev, const char *name); ++}; +-- +2.10.2 + diff --git a/patches/drivers/ti/sgx/0004-ARM-dts-am33xx-add-DT-node-for-gpu.patch b/patches/drivers/ti/sgx/0004-ARM-dts-am33xx-add-DT-node-for-gpu.patch new file mode 100644 index 000000000..8b0b469b4 --- /dev/null +++ b/patches/drivers/ti/sgx/0004-ARM-dts-am33xx-add-DT-node-for-gpu.patch @@ -0,0 +1,34 @@ +From 20171b32feee4ebc11339e95cc9664fd43123d95 Mon Sep 17 00:00:00 2001 +From: Darren Etheridge <detheridge@ti.com> +Date: Fri, 18 Jul 2014 16:19:54 -0500 +Subject: [PATCH 4/6] ARM: dts: am33xx: add DT node for gpu + +Add the node into the am33xx.dtsi file for the SGX GPU +that is found in some variants of the SoC. + +Signed-off-by: Darren Etheridge <detheridge@ti.com> +--- + arch/arm/boot/dts/am33xx.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi +index 3f609c8..0117413 100644 +--- a/arch/arm/boot/dts/am33xx.dtsi ++++ b/arch/arm/boot/dts/am33xx.dtsi +@@ -1048,6 +1048,13 @@ + reg = <0x48310000 0x2000>; + interrupts = <111>; + }; ++ ++ sgx@0x56000000 { ++ compatible = "ti,sgx"; ++ ti,hwmods = "gfx"; ++ reg = <0x56000000 0x1000000>; ++ interrupts = <37>; ++ }; + }; + }; + +-- +2.10.2 + diff --git a/patches/drivers/ti/sgx/0005-Revert-ARM-reduce-visibility-of-dmac_-functions.patch b/patches/drivers/ti/sgx/0005-Revert-ARM-reduce-visibility-of-dmac_-functions.patch new file mode 100644 index 000000000..08e04307d --- /dev/null +++ b/patches/drivers/ti/sgx/0005-Revert-ARM-reduce-visibility-of-dmac_-functions.patch @@ -0,0 +1,104 @@ +From df2d6cb53948d9f0641c72ae643eba19f13066b8 Mon Sep 17 00:00:00 2001 +From: Robert Nelson <robertcnelson@gmail.com> +Date: Mon, 4 Jan 2016 11:00:59 -0600 +Subject: [PATCH 5/6] Revert "ARM: reduce visibility of dmac_* functions" + +This reverts commit 1234e3fda9aa24b2d650bbcd9ef09d5f6a12dc86. + +Signed-off-by: Robert Nelson <robertcnelson@gmail.com> +--- + arch/arm/include/asm/cacheflush.h | 4 ++++ + arch/arm/include/asm/glue-cache.h | 2 ++ + arch/arm/mm/dma-mapping.c | 1 - + arch/arm/mm/dma.h | 32 -------------------------------- + 4 files changed, 6 insertions(+), 33 deletions(-) + delete mode 100644 arch/arm/mm/dma.h + +diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h +index bdd283b..b8039a6 100644 +--- a/arch/arm/include/asm/cacheflush.h ++++ b/arch/arm/include/asm/cacheflush.h +@@ -140,6 +140,8 @@ extern struct cpu_cache_fns cpu_cache; + * is visible to DMA, or data written by DMA to system memory is + * visible to the CPU. + */ ++#define dmac_map_area cpu_cache.dma_map_area ++#define dmac_unmap_area cpu_cache.dma_unmap_area + #define dmac_flush_range cpu_cache.dma_flush_range + + #else +@@ -159,6 +161,8 @@ extern void __cpuc_flush_dcache_area(void *, size_t); + * is visible to DMA, or data written by DMA to system memory is + * visible to the CPU. + */ ++extern void dmac_map_area(const void *, size_t, int); ++extern void dmac_unmap_area(const void *, size_t, int); + extern void dmac_flush_range(const void *, const void *); + + #endif +diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h +index 01c3d92..9f94cba 100644 +--- a/arch/arm/include/asm/glue-cache.h ++++ b/arch/arm/include/asm/glue-cache.h +@@ -154,6 +154,8 @@ static inline void nop_dma_unmap_area(const void *s, size_t l, int f) { } + #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range) + #define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area) + ++#define dmac_map_area __glue(_CACHE,_dma_map_area) ++#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area) + #define dmac_flush_range __glue(_CACHE,_dma_flush_range) + #endif + +diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c +index ab77100..12ddd32 100644 +--- a/arch/arm/mm/dma-mapping.c ++++ b/arch/arm/mm/dma-mapping.c +@@ -39,7 +39,6 @@ + #include <asm/system_info.h> + #include <asm/dma-contiguous.h> + +-#include "dma.h" + #include "mm.h" + + struct arm_dma_alloc_args { +diff --git a/arch/arm/mm/dma.h b/arch/arm/mm/dma.h +deleted file mode 100644 +index 70ea6852..0000000 +--- a/arch/arm/mm/dma.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-#ifndef DMA_H +-#define DMA_H +- +-#include <asm/glue-cache.h> +- +-#ifndef MULTI_CACHE +-#define dmac_map_area __glue(_CACHE,_dma_map_area) +-#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area) +- +-/* +- * These are private to the dma-mapping API. Do not use directly. +- * Their sole purpose is to ensure that data held in the cache +- * is visible to DMA, or data written by DMA to system memory is +- * visible to the CPU. +- */ +-extern void dmac_map_area(const void *, size_t, int); +-extern void dmac_unmap_area(const void *, size_t, int); +- +-#else +- +-/* +- * These are private to the dma-mapping API. Do not use directly. +- * Their sole purpose is to ensure that data held in the cache +- * is visible to DMA, or data written by DMA to system memory is +- * visible to the CPU. +- */ +-#define dmac_map_area cpu_cache.dma_map_area +-#define dmac_unmap_area cpu_cache.dma_unmap_area +- +-#endif +- +-#endif +-- +2.10.2 + diff --git a/patches/drivers/ti/sgx/0006-arm-Export-cache-flush-management-symbols-when-MULTI.patch b/patches/drivers/ti/sgx/0006-arm-Export-cache-flush-management-symbols-when-MULTI.patch new file mode 100644 index 000000000..7f6b30b25 --- /dev/null +++ b/patches/drivers/ti/sgx/0006-arm-Export-cache-flush-management-symbols-when-MULTI.patch @@ -0,0 +1,34 @@ +From 1f6c6f6ef1c0d687de7e376cb92fb1de6c1ca7de Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou <panto@antoniou-consulting.com> +Date: Fri, 4 Jan 2013 00:32:33 +0200 +Subject: [PATCH 6/6] arm: Export cache flush management symbols when + !MULTI_CACHE + +When compiling a kernel without CONFIG_MULTI_CACHE enabled the +dma access functions end up not being exported. Fix it. + +Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> +--- + arch/arm/kernel/setup.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c +index 34e3f3c..3325965 100644 +--- a/arch/arm/kernel/setup.c ++++ b/arch/arm/kernel/setup.c +@@ -1292,3 +1292,12 @@ const struct seq_operations cpuinfo_op = { + .stop = c_stop, + .show = c_show + }; ++ ++/* export the cache management functions */ ++#ifndef MULTI_CACHE ++ ++EXPORT_SYMBOL(__glue(_CACHE,_dma_map_area)); ++EXPORT_SYMBOL(__glue(_CACHE,_dma_unmap_area)); ++EXPORT_SYMBOL(__glue(_CACHE,_dma_flush_range)); ++ ++#endif +-- +2.10.2 + diff --git a/sgx_build_modules.sh b/sgx_build_modules.sh new file mode 100755 index 000000000..39ab1c005 --- /dev/null +++ b/sgx_build_modules.sh @@ -0,0 +1,285 @@ +#!/bin/bash -e +# +# Copyright (c) 2012-2015 Robert Nelson <robertcnelson@gmail.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +VERSION="v2015.01-1" + +unset DIR + +DIR=$PWD + +SDK="5.01.01.02" +sdk_version="5_01_01_02" +SDK_DIR="5_01_01_02" +SGX_SHA="origin/5.01.01.02" +#SGX_SHA="origin/${SDK}" + +http_ti="http://software-dl.ti.com/dsps/dsps_public_sw/gfxsdk/" +sgx_file="Graphics_SDK_setuplinux_hardfp_${sdk_version}.bin" +sgx_md5sum="94bcb31ea7eb50df1dfa4037055b638e" + +dl_sdk () { + echo "md5sum mis-match: ${md5sum} (re-downloading)" + wget -c --directory-prefix=${DIR}/dl ${http_ti}${sdk_version}/exports/${sgx_file} + if [ ! -f ${DIR}/dl/${sgx_file} ] ; then + echo "network failure" + exit + fi +} + +dl_n_verify_sdk () { + if [ -f "${DIR}/dl/${sgx_file}" ] ; then + echo "Verifying: ${sgx_file}" + md5sum=$(md5sum "${DIR}/dl/${sgx_file}" | awk '{print $1}') + if [ "x${sgx_md5sum}" != "x${md5sum}" ] ; then + echo "Debug: md5sum mismatch got: ${md5sum}" + rm -f "${DIR}/dl/${sgx_file}" || true + dl_sdk + else + echo "md5sum match: ${md5sum}" + fi + else + dl_sdk + fi +} + +install_sgx () { + if [ ! -f "${DIR}/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/verify.${sgx_md5sum}" ] ; then + echo "Installing: Graphics_SDK_setuplinux_${sdk_version}" + if [ -d "${DIR}/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}" ] ; then + rm -rf "${DIR}/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}" || true + fi + chmod +x "${DIR}"/dl/${sgx_file} + "${DIR}"/dl/${sgx_file} --mode console --prefix "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version} <<-__EOF__ + Y + qy + + __EOF__ + touch "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/verify.${sgx_md5sum} + else + echo "Graphics_SDK_setuplinux_${sdk_version} is installed" + fi +} + +set_sgx_make_vars () { + source ${DIR}/.CC + GRAPHICS_PATH="GRAPHICS_INSTALL_DIR="${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/"" + KERNEL_PATH="KERNEL_INSTALL_DIR="${DIR}/KERNEL"" + USER_VAR="HOME=/home/${USER}" + CSTOOL_PREFIX=${CC##*/} + + #Will probally have to revist this one later... + CSTOOL_DIR=$(echo ${CC} | awk -F "/bin/${CSTOOL_PREFIX}" '{print $1}') + + if [ "x${CSTOOL_PREFIX}" == "x${CSTOOL_DIR}" ] ; then + CSTOOL_DIR="/usr" + fi + + CROSS="CSTOOL_PREFIX=${CSTOOL_PREFIX} CSTOOL_DIR=${CSTOOL_DIR}" +} + +git_sgx_modules () { + if [ ! -f "${DIR}/ignore/ti-sdk-pvr/.git/config" ] ; then + git clone https://github.com/RobertCNelson/ti-sdk-pvr.git "${DIR}/ignore/ti-sdk-pvr/" + cd "${DIR}/ignore/ti-sdk-pvr/" + git checkout ${SGX_SHA} -b tmp-build + cd ${DIR}/ + else + cd "${DIR}/ignore/ti-sdk-pvr/" + git add . + git commit --allow-empty -a -m 'empty cleanup commit' + git checkout origin/master -b tmp-scratch + git branch -D tmp-build &>/dev/null || true + git fetch + git checkout ${SGX_SHA} -b tmp-build + git branch -D tmp-scratch &>/dev/null || true + cd ${DIR}/ + fi +} + +copy_sgx_es () { + echo "Copying: ${es_version} to build dir" + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf/gfx_rel_${es_version}" || true + cp -r "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/gfx_rel_${es_version}/* "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf/gfx_rel_${es_version}/" +} + +copy_sgx_binaries () { + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf" || true + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf" || true + fi + + echo "Starting: copying files from the SDK" + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/targetfs" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/targetfs" || true + fi + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/targetfs" || true + + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/tools" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/tools" || true + fi + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/tools" || true + + cp -r "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/tools "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + +# es_version="es5.x" +# copy_sgx_es + + es_version="es8.x" + copy_sgx_es + +# es_version="es9.x" +# copy_sgx_es +} + +clean_sgx_modules () { + echo "-----------------------------" + echo "make clean" + echo "-----------------------------" + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + pwd + echo "make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} clean" + make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} clean &> /dev/null + cd ${DIR}/ + echo "-----------------------------" +} + +build_sgx_modules () { + echo "-----------------------------" + echo "Building es$2 modules" + echo "-----------------------------" + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/" || true + fi + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/" || true + + pwd + echo "make BUILD={debug | release} OMAPES={5.x | 8.x | 9.x} FBDEV={yes | no} all" + echo "make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} BUILD="$1" OMAPES="$2" FBDEV="$3" "$4"" + make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} BUILD="$1" OMAPES="$2" FBDEV="$3" "$4" + cd ${DIR}/ + echo "-----------------------------" + echo "modinfo sanity check: vermagic:" + /sbin/modinfo "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/"pvr* | grep vermagic || true + echo "-----------------------------" +} + +installing_sgx_modules () { + echo "-----------------------------" + echo "Installing es$2 modules" + echo "-----------------------------" + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + + DESTDIR="${DIR}/deploy/$2" + if [ -d ${DESTDIR} ] ; then + rm -rf ${DESTDIR} || true + fi + mkdir -p ${DESTDIR} || true + mkdir -p ${DESTDIR}/etc/init.d/ || true + mkdir -p ${DESTDIR}/opt/ || true + + mkdir -p ${DESTDIR}/opt/gfxmodules/gfx_rel_es$2 || true + cp -v "${DIR}"/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/*.ko ${DESTDIR}/opt/gfxmodules/gfx_rel_es$2 || true + echo "-----------------------------" + + INSTALL_HOME="${DIR}/ignore/SDK_BIN/" + GRAPHICS_INSTALL_DIR="${INSTALL_HOME}Graphics_SDK_setuplinux_${sdk_version}" + + pwd + echo "make BUILD=(debug | release} OMAPES={5.x | 8.x | 9.x} install" + echo "make DESTDIR=${DESTDIR} HOME=${INSTALL_HOME} GRAPHICS_INSTALL_DIR=${GRAPHICS_INSTALL_DIR} BUILD="$1" OMAPES="$2" "$3"" + make DESTDIR=${DESTDIR} HOME=${INSTALL_HOME} GRAPHICS_INSTALL_DIR=${GRAPHICS_INSTALL_DIR} BUILD="$1" OMAPES="$2" "$3" + + #remove devmem2: + find "${DESTDIR}/" -name "devmem2" -exec rm -rf {} \; + rm -rf ${DESTDIR}/etc/init.d/335x-demo || true + rm -rf ${DESTDIR}/etc/init.d/43xx-demo || true + rm -rf ${DESTDIR}/etc/init.d/rc.pvr || true + + mkdir -p ${DESTDIR}/opt/gfxinstall/scripts/ || true + cp -v "${DIR}"/3rdparty/sgx-startup-sysv.sh ${DESTDIR}/opt/gfxinstall/scripts/ + cp -v "${DIR}"/3rdparty/sgx-install.sh ${DESTDIR}/opt/gfxinstall/ + chmod +x ${DESTDIR}/opt/gfxinstall/sgx-install.sh + + cd ${DESTDIR}/ + tar czf ${DIR}/deploy/GFX_${SDK}_es${2}.tar.gz * + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" +} + +if [ ! -f ${DIR}/system.sh ] ; then + cp -v ${DIR}/system.sh.sample ${DIR}/system.sh +fi + +source ${DIR}/system.sh +source ${DIR}/version.sh + +if [ ! -d "${DIR}/ignore/" ] ; then + mkdir "${DIR}/ignore/" +fi + +dl_n_verify_sdk +install_sgx + +set_sgx_make_vars + +git_sgx_modules +copy_sgx_binaries + +#No reason to rebuild the sdk... +sed -i -e 's:all_km all_sdk:all_km:g' "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/Makefile" +sed -i -e 's:install_km install_sdk:install_km:g' "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/Makefile" + +#Disable building of devmem2, as it breaks with hardfp based cross compilers, and we use the distro package anyways... +sed -i -e 's:prepare_km buildkernel builddevmem2:prepare_km buildkernel:g' "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/Makefile.KM" + +if [ ! -f "${DIR}/KERNEL/Makefile" ] ; then + echo "" + echo "ERROR: Run: ./build_kernel.sh first" + echo "" + exit +fi + +#Build: +#make BUILD={debug | release} OMAPES={5.x | 8.x | 9.x} FBDEV={yes | no} all +#Install: +#make BUILD=(debug | release} OMAPES={5.x | 8.x | 9.x} install + +# clean_sgx_modules +# build_sgx_modules release 5.x yes all + +clean_sgx_modules +build_sgx_modules release 8.x yes all +installing_sgx_modules release 8.x install + +# clean_sgx_modules +# build_sgx_modules release 9.x yes all +# installing_sgx_modules release 9.x install + +#Disable when debugging... +if [ -d "${DIR}/ignore/ti-sdk-pvr/pkg/" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/pkg" || true +fi +if [ -d "${DIR}/ignore/ti-sdk-pvr/examples/" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/examples" || true +fi + diff --git a/sgx_create_package.sh b/sgx_create_package.sh new file mode 100755 index 000000000..4b13076d4 --- /dev/null +++ b/sgx_create_package.sh @@ -0,0 +1,285 @@ +#!/bin/bash -e +# +# Copyright (c) 2012-2015 Robert Nelson <robertcnelson@gmail.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +VERSION="v2015.01-1" + +unset DIR + +DIR=$PWD + +SDK="5.01.01.02" +sdk_version="5_01_01_02" +SDK_DIR="5_01_01_02" +SGX_SHA="origin/5.01.01.02" +#SGX_SHA="origin/${SDK}" + +http_ti="http://software-dl.ti.com/dsps/dsps_public_sw/gfxsdk/" +sgx_file="Graphics_SDK_setuplinux_hardfp_${sdk_version}.bin" +sgx_md5sum="94bcb31ea7eb50df1dfa4037055b638e" + +dl_sdk () { + echo "md5sum mis-match: ${md5sum} (re-downloading)" + wget -c --directory-prefix=${DIR}/dl ${http_ti}${sdk_version}/exports/${sgx_file} + if [ ! -f ${DIR}/dl/${sgx_file} ] ; then + echo "network failure" + exit + fi +} + +dl_n_verify_sdk () { + if [ -f "${DIR}/dl/${sgx_file}" ] ; then + echo "Verifying: ${sgx_file}" + md5sum=$(md5sum "${DIR}/dl/${sgx_file}" | awk '{print $1}') + if [ "x${sgx_md5sum}" != "x${md5sum}" ] ; then + echo "Debug: md5sum mismatch got: ${md5sum}" + rm -f "${DIR}/dl/${sgx_file}" || true + dl_sdk + else + echo "md5sum match: ${md5sum}" + fi + else + dl_sdk + fi +} + +install_sgx () { + if [ ! -f "${DIR}/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/verify.${sgx_md5sum}" ] ; then + echo "Installing: Graphics_SDK_setuplinux_${sdk_version}" + if [ -d "${DIR}/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}" ] ; then + rm -rf "${DIR}/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}" || true + fi + chmod +x "${DIR}"/dl/${sgx_file} + "${DIR}"/dl/${sgx_file} --mode console --prefix "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version} <<-__EOF__ + Y + qy + + __EOF__ + touch "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/verify.${sgx_md5sum} + else + echo "Graphics_SDK_setuplinux_${sdk_version} is installed" + fi +} + +set_sgx_make_vars () { +# source ${DIR}/.CC + GRAPHICS_PATH="GRAPHICS_INSTALL_DIR="${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/"" + KERNEL_PATH="KERNEL_INSTALL_DIR="${DIR}/KERNEL"" + USER_VAR="HOME=/home/${USER}" + CSTOOL_PREFIX=${CC##*/} + + #Will probally have to revist this one later... + CSTOOL_DIR=$(echo ${CC} | awk -F "/bin/${CSTOOL_PREFIX}" '{print $1}') + + if [ "x${CSTOOL_PREFIX}" == "x${CSTOOL_DIR}" ] ; then + CSTOOL_DIR="/usr" + fi + + CROSS="CSTOOL_PREFIX=${CSTOOL_PREFIX} CSTOOL_DIR=${CSTOOL_DIR}" +} + +git_sgx_modules () { + if [ ! -f "${DIR}/ignore/ti-sdk-pvr/.git/config" ] ; then + git clone https://github.com/RobertCNelson/ti-sdk-pvr.git "${DIR}/ignore/ti-sdk-pvr/" + cd "${DIR}/ignore/ti-sdk-pvr/" + git checkout ${SGX_SHA} -b tmp-build + cd ${DIR}/ + else + cd "${DIR}/ignore/ti-sdk-pvr/" + git add . + git commit --allow-empty -a -m 'empty cleanup commit' + git checkout origin/master -b tmp-scratch + git branch -D tmp-build &>/dev/null || true + git fetch + git checkout ${SGX_SHA} -b tmp-build + git branch -D tmp-scratch &>/dev/null || true + cd ${DIR}/ + fi +} + +copy_sgx_es () { + echo "Copying: ${es_version} to build dir" + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf/gfx_rel_${es_version}" || true + cp -r "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/gfx_rel_${es_version}/* "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf/gfx_rel_${es_version}/" +} + +copy_sgx_binaries () { + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf" || true + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/armhf" || true + fi + + echo "Starting: copying files from the SDK" + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/targetfs" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/targetfs" || true + fi + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/targetfs" || true + + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/tools" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/tools" || true + fi + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/tools" || true + + cp -r "${DIR}"/ignore/SDK_BIN/Graphics_SDK_setuplinux_${sdk_version}/tools "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + +# es_version="es5.x" +# copy_sgx_es + + es_version="es8.x" + copy_sgx_es + +# es_version="es9.x" +# copy_sgx_es +} + +clean_sgx_modules () { + echo "-----------------------------" + echo "make clean" + echo "-----------------------------" + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + pwd + echo "make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} clean" + make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} clean &> /dev/null + cd ${DIR}/ + echo "-----------------------------" +} + +build_sgx_modules () { + echo "-----------------------------" + echo "Building es$2 modules" + echo "-----------------------------" + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + + if [ -d "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/" || true + fi + mkdir -p "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/" || true + + pwd + echo "make BUILD={debug | release} OMAPES={5.x | 8.x | 9.x} FBDEV={yes | no} all" + echo "make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} BUILD="$1" OMAPES="$2" FBDEV="$3" "$4"" + make ${GRAPHICS_PATH} ${KERNEL_PATH} HOME=${HOME} ${CROSS} BUILD="$1" OMAPES="$2" FBDEV="$3" "$4" + cd ${DIR}/ + echo "-----------------------------" + echo "modinfo sanity check: vermagic:" + /sbin/modinfo "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/"pvr* | grep vermagic || true + echo "-----------------------------" +} + +installing_sgx_modules () { + echo "-----------------------------" + echo "Installing es$2 modules" + echo "-----------------------------" + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" + + DESTDIR="${DIR}/deploy/$2" + if [ -d ${DESTDIR} ] ; then + rm -rf ${DESTDIR} || true + fi + mkdir -p ${DESTDIR} || true + mkdir -p ${DESTDIR}/etc/init.d/ || true + mkdir -p ${DESTDIR}/opt/ || true + + mkdir -p ${DESTDIR}/opt/gfxmodules/gfx_rel_es$2 || true + cp -v "${DIR}"/ignore/ti-sdk-pvr/Graphics_SDK/gfx_rel_es$2/*.ko ${DESTDIR}/opt/gfxmodules/gfx_rel_es$2 || true + echo "-----------------------------" + + INSTALL_HOME="${DIR}/ignore/SDK_BIN/" + GRAPHICS_INSTALL_DIR="${INSTALL_HOME}Graphics_SDK_setuplinux_${sdk_version}" + + pwd + echo "make BUILD=(debug | release} OMAPES={5.x | 8.x | 9.x} install" + echo "make DESTDIR=${DESTDIR} HOME=${INSTALL_HOME} GRAPHICS_INSTALL_DIR=${GRAPHICS_INSTALL_DIR} BUILD="$1" OMAPES="$2" "$3"" + make DESTDIR=${DESTDIR} HOME=${INSTALL_HOME} GRAPHICS_INSTALL_DIR=${GRAPHICS_INSTALL_DIR} BUILD="$1" OMAPES="$2" "$3" + + #remove devmem2: + find "${DESTDIR}/" -name "devmem2" -exec rm -rf {} \; + rm -rf ${DESTDIR}/etc/init.d/335x-demo || true + rm -rf ${DESTDIR}/etc/init.d/43xx-demo || true + rm -rf ${DESTDIR}/etc/init.d/rc.pvr || true + + mkdir -p ${DESTDIR}/opt/gfxinstall/scripts/ || true + cp -v "${DIR}"/3rdparty/sgx-startup-sysv.sh ${DESTDIR}/opt/gfxinstall/scripts/ + cp -v "${DIR}"/3rdparty/sgx-install.sh ${DESTDIR}/opt/gfxinstall/ + chmod +x ${DESTDIR}/opt/gfxinstall/sgx-install.sh + + cd ${DESTDIR}/ + tar czf ${DIR}/deploy/GFX_${SDK}_es${2}.tar.gz * + cd "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/" +} + +if [ ! -f ${DIR}/system.sh ] ; then + cp -v ${DIR}/system.sh.sample ${DIR}/system.sh +fi + +source ${DIR}/system.sh +source ${DIR}/version.sh + +if [ ! -d "${DIR}/ignore/" ] ; then + mkdir "${DIR}/ignore/" +fi + +dl_n_verify_sdk +install_sgx + +set_sgx_make_vars + +git_sgx_modules +copy_sgx_binaries + +#No reason to rebuild the sdk... +sed -i -e 's:all_km all_sdk:all_km:g' "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/Makefile" +sed -i -e 's:install_km install_sdk:install_km:g' "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/Makefile" + +#Disable building of devmem2, as it breaks with hardfp based cross compilers, and we use the distro package anyways... +sed -i -e 's:prepare_km buildkernel builddevmem2:prepare_km buildkernel:g' "${DIR}/ignore/ti-sdk-pvr/Graphics_SDK/Makefile.KM" + +#if [ ! -f "${DIR}/KERNEL/Makefile" ] ; then +# echo "" +# echo "ERROR: Run: ./build_kernel.sh first" +# echo "" +# exit +#fi + +#Build: +#make BUILD={debug | release} OMAPES={5.x | 8.x | 9.x} FBDEV={yes | no} all +#Install: +#make BUILD=(debug | release} OMAPES={5.x | 8.x | 9.x} install + +# clean_sgx_modules +# build_sgx_modules release 5.x yes all + +clean_sgx_modules +#build_sgx_modules release 8.x yes all +installing_sgx_modules release 8.x install + +# clean_sgx_modules +# build_sgx_modules release 9.x yes all +# installing_sgx_modules release 9.x install + +#Disable when debugging... +if [ -d "${DIR}/ignore/ti-sdk-pvr/pkg/" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/pkg" || true +fi +if [ -d "${DIR}/ignore/ti-sdk-pvr/examples/" ] ; then + rm -rf "${DIR}/ignore/ti-sdk-pvr/examples" || true +fi + -- GitLab