tools: add tools for i.MX23 boards
authorZoltan Herpai <wigyori@uid0.hu>
Wed, 26 Jun 2013 10:15:29 +0000 (10:15 +0000)
committerZoltan Herpai <wigyori@uid0.hu>
Wed, 26 Jun 2013 10:15:29 +0000 (10:15 +0000)
SVN-Revision: 37035

package/boot/imx-bootlets/Makefile [new file with mode: 0644]
package/boot/imx-bootlets/patches/001-skip_sb_generation.patch [new file with mode: 0644]
package/boot/imx-bootlets/patches/002-set_elftosb_config.patch [new file with mode: 0644]
package/boot/imx-bootlets/patches/003-add-olinuxino.patch [new file with mode: 0644]
tools/Makefile
tools/elftosb/Makefile [new file with mode: 0644]
tools/elftosb/patches/001-libm.patch [new file with mode: 0644]
tools/elftosb/patches/002-fix-header-path.patch [new file with mode: 0644]

diff --git a/package/boot/imx-bootlets/Makefile b/package/boot/imx-bootlets/Makefile
new file mode 100644 (file)
index 0000000..1c6a23c
--- /dev/null
@@ -0,0 +1,42 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=imx-bootlets
+PKG_VERSION:=10.05.02
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://trabant.uid0.hu/openwrt/
+PKG_MD5SUM:=82e375193b66ca643023c1656d536282
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/imx-bootlets
+       SECTION:=boot
+       CATEGORY:=Boot Loaders
+       TITLE:=i.MX23 bootlets
+       DEPENDS:=@TARGET_imx23
+endef
+
+define Package/imx-bootlets/description
+ i.MX23 bootlets (for oLinuxino)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)"
+endef
+
+define Package/imx-bootlets/install
+       @echo Copying boot_prep and power_prep into staging - $(STAGING_DIR)
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/boot_prep/boot_prep $(STAGING_DIR)/boot_prep
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux_prep/output-target/linux_prep $(STAGING_DIR)/linux_prep
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/power_prep/power_prep $(STAGING_DIR)/power_prep
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux_prebuilt.db $(STAGING_DIR)/linux_prebuilt.db
+endef
+
+$(eval $(call BuildPackage,imx-bootlets))
+
diff --git a/package/boot/imx-bootlets/patches/001-skip_sb_generation.patch b/package/boot/imx-bootlets/patches/001-skip_sb_generation.patch
new file mode 100644 (file)
index 0000000..7267dff
--- /dev/null
@@ -0,0 +1,18 @@
+--- imx-bootlets-src-10.05.02.orig/Makefile    2010-05-14 06:56:28.000000000 +0200
++++ imx-bootlets-src-10.05.02/Makefile 2012-10-24 21:41:44.000000000 +0200
+@@ -32,10 +32,11 @@
+       sed -i 's,[^ *]image.*;,\timage="$(DFT_UBOOT)";,' uboot.db
+       elftosb2 -z -c ./uboot.db -o i$(ARCH)_uboot.sb
+ else
+-      @echo "by using the pre-built kernel"
+-      elftosb2 -z -c ./linux_prebuilt.db -o i$(ARCH)_linux.sb
+-      @echo "generating U-Boot boot stream image"
+-      elftosb2 -z -c ./uboot_prebuilt.db -o i$(ARCH)_uboot.sb
++      @echo "... not generating any image for now."
++      #@echo "by using the pre-built kernel"
++      #elftosb2 -z -c ./linux_prebuilt.db -o i$(ARCH)_linux.sb
++      #@echo "generating U-Boot boot stream image"
++      #elftosb2 -z -c ./uboot_prebuilt.db -o i$(ARCH)_uboot.sb
+ endif
+       #@echo "generating kernel bootstream file sd_mmc_bootstream.raw"
+       #Please use cfimager to burn xxx_linux.sb. The below way will no
diff --git a/package/boot/imx-bootlets/patches/002-set_elftosb_config.patch b/package/boot/imx-bootlets/patches/002-set_elftosb_config.patch
new file mode 100644 (file)
index 0000000..88b904e
--- /dev/null
@@ -0,0 +1,17 @@
+--- imx-bootlets-10.05.02.orig/linux_prebuilt.db       2010-05-14 06:56:28.000000000 +0200
++++ imx-bootlets-10.05.02/linux_prebuilt.db    2012-10-24 22:04:37.000000000 +0200
+@@ -4,10 +4,10 @@
+       flags = 0x01;
+ }
+ sources {
+-      power_prep="./power_prep/power_prep";
+-      sdram_prep="./boot_prep/boot_prep";
+-      linux_prep="./linux_prep/output-target/linux_prep";
+-      zImage = "./zImage";
++      power_prep="./power_prep";
++      sdram_prep="./boot_prep";
++      linux_prep="./linux_prep";
++      zImage = "./zImage_dtb";
+ }
+ section (0) {
diff --git a/package/boot/imx-bootlets/patches/003-add-olinuxino.patch b/package/boot/imx-bootlets/patches/003-add-olinuxino.patch
new file mode 100644 (file)
index 0000000..ddc25bc
--- /dev/null
@@ -0,0 +1,150 @@
+diff -ruN imx-bootlets-10.05.02.orig/linux_prep/board/imx23_olinuxino_dev.c imx-bootlets-10.05.02/linux_prep/board/imx23_olinuxino_dev.c
+--- imx-bootlets-10.05.02.orig/linux_prep/board/imx23_olinuxino_dev.c  1970-01-01 01:00:00.000000000 +0100
++++ imx-bootlets-10.05.02/linux_prep/board/imx23_olinuxino_dev.c       2013-05-19 00:11:40.000000000 +0200
+@@ -0,0 +1,54 @@
++/*
++ * Platform specific data for the IMX23_OLINUXINO development board
++ *
++ * Fadil Berisha <fadil.r.berisha@gmail.com>
++ *
++ * Copyright 2008 SigmaTel, Inc
++ * Copyright 2008 Embedded Alley Solutions, Inc
++ * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
++ *
++ * This file is licensed under the terms of the GNU General Public License
++ * version 2. This program is licensed "as is" without any warranty of any
++ * kind, whether express or implied.
++ *
++ * http://www.opensource.org/licenses/gpl-license.html
++ * http://www.gnu.org/copyleft/gpl.html
++ */
++#include <setup.h>
++#include <keys.h>
++#include <lradc_buttons.h>
++
++/************************************************
++ * LRADC keyboard data *
++ ************************************************/
++int lradc_keypad_ch = LRADC_CH0;
++int lradc_vddio_ch = LRADC_CH6;
++
++struct lradc_keycode lradc_keycodes[] = {
++ { 100, KEY4 },
++ { 306, KEY5 },
++ { 601, KEY6 },
++ { 932, KEY7 },
++ { 1260, KEY8 },
++ { 1424, KEY9 },
++ { 1707, KEY10 },
++ { 2207, KEY11 },
++ { 2525, KEY12 },
++ { 2831, KEY13 },
++ { 3134, KEY14 },
++ { -1, 0 },
++};
++
++/************************************************
++ * Magic key combinations for Armadillo *
++ ************************************************/
++u32 magic_keys[MAGIC_KEY_NR] = {
++ [MAGIC_KEY1] = KEY4,
++ [MAGIC_KEY2] = KEY6,
++ [MAGIC_KEY3] = KEY10,
++};
++
++/************************************************
++ * Default command line *
++ ************************************************/
++char cmdline_def[] = "console=ttyAMA0,115200";
+diff -ruN imx-bootlets-10.05.02.orig/linux_prep/cmdlines/imx23_olinuxino_dev.txt imx-bootlets-10.05.02/linux_prep/cmdlines/imx23_olinuxino_dev.txt
+--- imx-bootlets-10.05.02.orig/linux_prep/cmdlines/imx23_olinuxino_dev.txt     1970-01-01 01:00:00.000000000 +0100
++++ imx-bootlets-10.05.02/linux_prep/cmdlines/imx23_olinuxino_dev.txt  2013-05-19 00:12:56.000000000 +0200
+@@ -0,0 +1 @@
++noinitrd console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait ssp1=mmc
+diff -ruN imx-bootlets-10.05.02.orig/linux_prep/core/setup.c imx-bootlets-10.05.02/linux_prep/core/setup.c
+--- imx-bootlets-10.05.02.orig/linux_prep/core/setup.c 2010-05-14 06:56:28.000000000 +0200
++++ imx-bootlets-10.05.02/linux_prep/core/setup.c      2013-05-19 00:11:40.000000000 +0200
+@@ -84,6 +84,8 @@
+ #include "../../mach-mx28/includes/registers/regsrtc.h"
+ #elif defined(STMP378X)
+ #include "../../mach-mx23/includes/registers/regsrtc.h"
++#elif defined(IMX23_OLINUXINO)
++#include "../../mach-mx23/includes/registers/regsrtc.h"
+ #endif
+ #define NAND_SECONDARY_BOOT          0x00000002
+diff -ruN imx-bootlets-10.05.02.orig/linux_prep/include/mx23/platform.h imx-bootlets-10.05.02/linux_prep/include/mx23/platform.h
+--- imx-bootlets-10.05.02.orig/linux_prep/include/mx23/platform.h      2010-05-14 06:56:28.000000000 +0200
++++ imx-bootlets-10.05.02/linux_prep/include/mx23/platform.h   2013-05-19 00:11:40.000000000 +0200
+@@ -19,6 +19,10 @@
+ #if defined (BOARD_STMP378X_DEV)
+ #define       MACHINE_ID      0xa45
++
++#elif defined (BOARD_IMX23_OLINUXINO_DEV)
++#define MACHINE_ID 0x1009
++
+ #else
+ #error "Allocate a machine ID for your board"
+ #endif
+diff -ruN imx-bootlets-10.05.02.orig/linux_prep/Makefile imx-bootlets-10.05.02/linux_prep/Makefile
+--- imx-bootlets-10.05.02.orig/linux_prep/Makefile     2010-05-14 06:56:28.000000000 +0200
++++ imx-bootlets-10.05.02/linux_prep/Makefile  2013-05-19 00:11:40.000000000 +0200
+@@ -69,6 +69,11 @@
+ HW_OBJS = $(LRADC_OBJS)
+ CFLAGS += -DMX28 -DBOARD_MX28_EVK
+ endif
++ifeq ($(BOARD), imx23_olinuxino_dev)
++ARCH = mx23
++HW_OBJS = $(LRADC_OBJS)
++CFLAGS += -DIMX23_OLINUXINO -DBOARD_IMX23_OLINUXINO_DEV
++endif
+ # Generic code
+ CORE_OBJS = entry.o resume.o cmdlines.o setup.o keys.o
+diff -ruN imx-bootlets-10.05.02.orig/Makefile imx-bootlets-10.05.02/Makefile
+--- imx-bootlets-10.05.02.orig/Makefile        2010-05-14 06:56:28.000000000 +0200
++++ imx-bootlets-10.05.02/Makefile     2013-05-19 00:15:02.000000000 +0200
+@@ -3,9 +3,9 @@
+ export MEM_TYPE
+ DFT_IMAGE=$(DEV_IMAGE)/boot/zImage
+-DFT_UBOOT=$(DEV_IMAGE)/boot/u-boot
++DFT_UBOOT=../boot/u-boot
+-BOARD ?= stmp378x_dev
++BOARD ?= imx23_olinuxino_dev
+ ifeq ($(BOARD), stmp37xx_dev)
+ ARCH = 37xx
+@@ -16,6 +16,9 @@
+ ifeq ($(BOARD), iMX28_EVK)
+ ARCH = mx28
+ endif
++ifeq ($(BOARD), imx23_olinuxino_dev)
++ARCH = mx23
++endif
+ all: build_prep gen_bootstream
+@@ -93,6 +96,8 @@
+ clean:
+       -rm -rf *.sb
+       rm -f sd_mmc_bootstream.raw
++      rm -f linux_prep/board/*.o
++      rm -f power_prep/*.o
+       $(MAKE) -C linux_prep clean ARCH=$(ARCH)
+       $(MAKE) -C boot_prep clean ARCH=$(ARCH)
+       $(MAKE) -C power_prep clean ARCH=$(ARCH)
+diff -ruN imx-bootlets-10.05.02.orig/uboot.db imx-bootlets-10.05.02/uboot.db
+--- imx-bootlets-10.05.02.orig/uboot.db        2010-05-14 06:56:28.000000000 +0200
++++ imx-bootlets-10.05.02/uboot.db     2013-05-19 00:11:40.000000000 +0200
+@@ -3,7 +3,7 @@
+ sources {
+       power_prep="./power_prep/power_prep";
+       sdram_prep="./boot_prep/boot_prep";
+-      image="/home/b18647/repos/ltib_latest/rootfs/boot/u-boot";
++      image="../boot/u-boot";
+ }
+ section (0) {
index 1d65e50..61b53a9 100644 (file)
@@ -20,6 +20,7 @@ tools-y += mm-macros xorg-macros xfce-macros missing-macros xz cmake scons
 tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
 tools-$(CONFIG_powerpc) += upx
 tools-$(CONFIG_TARGET_x86) += qemu
+tools-$(CONFIG_TARGET_imx23) += elftosb
 tools-$(CONFIG_TARGET_brcm2708) += mtools dosfstools
 ifneq ($(CONFIG_TARGET_ar71xx),)
 tools-y += lzma-old squashfs
diff --git a/tools/elftosb/Makefile b/tools/elftosb/Makefile
new file mode 100644 (file)
index 0000000..c063217
--- /dev/null
@@ -0,0 +1,31 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=elftosb
+PKG_VERSION:=10.12.01
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://repository.timesys.com/buildsources/e/elftosb/elftosb-10.12.01/
+PKG_MD5SUM:=e8005d606c1e0bb3507c82f6eceb3056
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Compile
+       $(MAKE) -C $(HOST_BUILD_DIR) -f makefile LDFLAGS="$(HOST_STATIC_LINKING)"
+endef
+
+define Host/Install
+       $(INSTALL_BIN) $(HOST_BUILD_DIR)/bld/linux/elftosb $(STAGING_DIR_HOST)/bin/elftosb
+endef
+
+define Host/Clean
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/elftosb/patches/001-libm.patch b/tools/elftosb/patches/001-libm.patch
new file mode 100644 (file)
index 0000000..02705d2
--- /dev/null
@@ -0,0 +1,11 @@
+--- elftosb-10.12.01/makefile.rules    2012-03-15 11:01:44.979020178 -0400
++++ elftosb-10.12.01/makefile.rules    2012-03-15 11:01:16.332761989 -0400
+@@ -101,7 +101,7 @@
+       keygen.o
+-LIBS =     -lstdc++
++LIBS =     -lstdc++ -lm
+ ifeq ("${UNAMES}", "Linux")
diff --git a/tools/elftosb/patches/002-fix-header-path.patch b/tools/elftosb/patches/002-fix-header-path.patch
new file mode 100644 (file)
index 0000000..5e3b509
--- /dev/null
@@ -0,0 +1,19 @@
+This package had an absolute path for sys/types.h, which doesn't
+make much sense. It breaks on newer Ubuntu systems, and probably many
+others once multiarch becomes more common.
+
+This patch makes the types a relative path, and allows the system
+to use whatever include paths it feels are correct.
+
+diff -Naurp elftosb-10.12.01-orig/common/stdafx.h elftosb-10.12.01/common/stdafx.h
+--- elftosb-10.12.01-orig/common/stdafx.h      2012-07-12 13:30:10.990249396 -0400
++++ elftosb-10.12.01/common/stdafx.h   2012-07-12 13:30:06.858249391 -0400
+@@ -27,7 +27,7 @@
+ // For Linux systems only, types.h only defines the signed
+ // integer types.  This is not professional code.
+ // Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
+-#include "/usr/include/sys/types.h"
++#include <sys/types.h>
+ #include <stdint.h>
+ //typedef unsigned long uint32_t;
+ //typedef unsigned short uint16_t;