The following describes how to build a big-endian Linux kernel and install it to a Jetson TK1 system. It's a proof of concept showing how it is possible to run a big-endian ARM system.

Video Link

Connect the USB to serial and USB to microUSB cables from your system to the Jetson board. There should be an SD card inserted into the Jetson.

sudo apt-get -y install gcc-arm-linux-gnueabihf
mkdir -p ~/develop/baserock/bigendian
cd ~/develop/baserock/bigendian
git clone https://github.com/bashrc/linux
cd ~/develop/baserock/bigendian/linux
git remote add upstream http://git.baserock.org/git/delta/linux.git
git checkout bashrc/tegra-big-endian
mkdir -p ~/develop/baserock/bigendian/linux/build

Edit arch/arm/Kconfig and under ARCH_SUSPEND_POSSIBLE set def_bool to "n". In this demo suspend doesn't work with big-endian (that will not doubt require further patches) and so it is disabled.

Now compile the kernel

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make mrproper
make O=build tegra_be_defconfig
make O=build -j3

At least one version of the GCC cross-compiler (4.7.2) does not work properly and the build aborts with a descriptive error. If you get this, upgrade to a later version of the compiler (e.g. 4.9). If you are using Debian, consider upgrading to Jessie (or later version) as it includes a more up to date version of the compiler.

Now establish serial communications with the board.

sudo screen /dev/ttyUSB0 115200

Press the reset button on the Jetson (the middle one of three), then hit any key to stop the boot. You will see a new drive become available and select it to mount it. It should then be visible under /media/$USER

ums 0 mmc 0

Transfer the rootfs

export SDCARD=/media/$USER/<drive>
sudo cp -r ~/develop/baserock/bigendian/linux/build/* $SDCARD

Configure the boot.

sudo mkdir $SDCARD/extlinux
echo 'default factory' > /tmp/extlinux.conf
echo 'menu title baserock boot options' >> /tmp/extlinux.conf
echo 'default menu.c32' >> /tmp/extlinux.conf
echo 'timeout 50' >> /tmp/extlinux.conf
echo 'prompt 0' >> /tmp/extlinux.conf
echo 'ontimeout factory' >> /tmp/extlinux.conf
echo 'label factory' >> /tmp/extlinux.conf
echo 'kernel /boot/kernel.bin' >> /tmp/extlinux.conf
echo 'devicetree /boot/dtb' >> /tmp/extlinux.conf
echo 'append rw init=/bin/bash root=/dev/mmcblk0p1 cma=256M console=ttyS0,115200n8 _console_suspend=1 debug ignore_loglevel log_buf_len=10M print_fatal_signals=1 LOGLEVEL=8 earlyprintk=console,keep sched_debug' >> /tmp/extlinux.conf
sudo cp /tmp/extlinux.conf $SDCARD/extlinux/extlinux.conf
sudo mkdir $SDCARD/boot

Transfer the kernel

export SDCARD=/media/$USER/<drive>
sudo cp ~/develop/baserock/bigendian/linux/build/arch/arm/boot/zImage $SDCARD/boot/kernel.bin
sudo cp ~/develop/baserock/bigendian/linux/build/arch/arm/boot/dts/tegra124-jetson-tk1.dtb $SDCARD/boot/dtb
sync
sudo umount $SDCARD

Press the reset button on the Jetson again.

ums 0 mmc 1

Then on your system mount the drive which appears and enter the following.

export SDCARD=/media/$USER/<drive>
sudo cp ~/develop/baserock/bigendian/linux/build/arch/arm/boot/zImage $SDCARD/boot/kernel.bin
sudo cp ~/develop/baserock/bigendian/linux/build/arch/arm/boot/dts/tegra124-jetson-tk1.dtb $SDCARD/boot/dtb
sync
sudo umount $SDCARD

Press reset again and the system should boot to a bash command prompt.

If the Github repo isn't available then the patches necessary for big-endian are as follows.

Patch 1

From 3f480feadfcf5d24c3614958fbc3db3a1177e4aa Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob.mottram@codethink.co.uk>
Date: Thu, 8 Jan 2015 17:13:43 +0000
Subject: [PATCH 1/4] ARM: tegra: Add a separate big-endian configuration

Create a separate configuration file for tegra big-endian.
The only change from tegra_defconfig is the addition of the
first two lines.

Signed-off-by: Bob Mottram <bob.mottram@codethink.co.uk>
---
 arch/arm/configs/tegra_be_defconfig | 298 ++++++++++++++++++++++++++++++++++++
 1 file changed, 298 insertions(+)
 create mode 100644 arch/arm/configs/tegra_be_defconfig

diff --git a/arch/arm/configs/tegra_be_defconfig b/arch/arm/configs/tegra_be_defconfig
new file mode 100644
index 0000000..c0a8636
--- /dev/null
+++ b/arch/arm/configs/tegra_be_defconfig
@@ -0,0 +1,298 @@
+CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_SYSVIPC=y
+CONFIG_FHANDLE=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_DEBUG=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_RESOURCE_COUNTERS=y
+CONFIG_CGROUP_SCHED=y
+CONFIG_RT_GROUP_SCHED=y
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_ELF_CORE is not set
+CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
+CONFIG_SLAB=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_ARCH_TEGRA=y
+CONFIG_ARCH_TEGRA_2x_SOC=y
+CONFIG_ARCH_TEGRA_3x_SOC=y
+CONFIG_ARCH_TEGRA_114_SOC=y
+CONFIG_ARCH_TEGRA_124_SOC=y
+CONFIG_PCI=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_TEGRA=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_SMP=y
+CONFIG_PREEMPT=y
+CONFIG_AEABI=y
+CONFIG_HIGHMEM=y
+CONFIG_CMA=y
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_KEXEC=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+CONFIG_CPU_IDLE=y
+CONFIG_VFP=y
+CONFIG_NEON=y
+CONFIG_PM=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_NET_KEY=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
+CONFIG_INET_ESP=y
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+CONFIG_IPV6=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=y
+CONFIG_INET6_ESP=y
+CONFIG_INET6_IPCOMP=y
+CONFIG_IPV6_MIP6=y
+CONFIG_IPV6_TUNNEL=y
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_CAN=y
+CONFIG_CAN_MCP251X=y
+CONFIG_BT=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_HIDP=y
+CONFIG_BT_HCIBTUSB=m
+CONFIG_CFG80211=y
+CONFIG_MAC80211=y
+CONFIG_RFKILL=y
+CONFIG_RFKILL_INPUT=y
+CONFIG_RFKILL_GPIO=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_DMA_CMA=y
+CONFIG_CMA_SIZE_MBYTES=64
+CONFIG_MTD=y
+CONFIG_MTD_M25P80=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_AD525X_DPOT=y
+CONFIG_AD525X_DPOT_I2C=y
+CONFIG_ICS932S401=y
+CONFIG_APDS9802ALS=y
+CONFIG_ISL29003=y
+CONFIG_EEPROM_AT24=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_BLK_DEV_SR=y
+# CONFIG_SCSI_LOWLEVEL is not set
+CONFIG_ATA=y
+CONFIG_SATA_AHCI=y
+CONFIG_AHCI_TEGRA=y
+CONFIG_NETDEVICES=y
+CONFIG_DUMMY=y
+CONFIG_IGB=y
+CONFIG_R8169=y
+CONFIG_USB_PEGASUS=y
+CONFIG_USB_USBNET=y
+CONFIG_USB_NET_SMSC75XX=y
+CONFIG_USB_NET_SMSC95XX=y
+CONFIG_BRCMFMAC=m
+CONFIG_RT2X00=y
+CONFIG_RT2800USB=m
+CONFIG_INPUT_JOYDEV=y
+CONFIG_INPUT_EVDEV=y
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_TEGRA=y
+CONFIG_KEYBOARD_CROS_EC=y
+CONFIG_MOUSE_PS2_ELANTECH=y
+CONFIG_INPUT_TOUCHSCREEN=y
+CONFIG_TOUCHSCREEN_ATMEL_MXT=y
+CONFIG_TOUCHSCREEN_STMPE=y
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_MPU3050=y
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_TEGRA=y
+CONFIG_SERIAL_OF_PLATFORM=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_MUX_PCA954x=y
+CONFIG_I2C_MUX_PINCTRL=y
+CONFIG_I2C_TEGRA=y
+CONFIG_SPI=y
+CONFIG_SPI_TEGRA114=y
+CONFIG_SPI_TEGRA20_SFLASH=y
+CONFIG_SPI_TEGRA20_SLINK=y
+CONFIG_PINCTRL_AS3722=y
+CONFIG_PINCTRL_PALMAS=y
+CONFIG_GPIO_PCA953X=y
+CONFIG_GPIO_PCA953X_IRQ=y
+    CONFIG_GPIO_PALMAS=y
+CONFIG_GPIO_TPS6586X=y
+CONFIG_GPIO_TPS65910=y
+CONFIG_POWER_SUPPLY=y
+CONFIG_BATTERY_SBS=y
+CONFIG_CHARGER_TPS65090=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_AS3722=y
+CONFIG_POWER_RESET_GPIO=y
+CONFIG_SENSORS_LM90=y
+CONFIG_SENSORS_LM95245=y
+CONFIG_MFD_AS3722=y
+CONFIG_MFD_CROS_EC=y
+CONFIG_MFD_CROS_EC_SPI=y
+CONFIG_MFD_MAX8907=y
+CONFIG_MFD_STMPE=y
+CONFIG_MFD_PALMAS=y
+CONFIG_MFD_TPS65090=y
+CONFIG_MFD_TPS6586X=y
+CONFIG_MFD_TPS65910=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_AS3722=y
+CONFIG_REGULATOR_GPIO=y
+CONFIG_REGULATOR_MAX8907=y
+CONFIG_REGULATOR_PALMAS=y
+CONFIG_REGULATOR_TPS51632=y
+CONFIG_REGULATOR_TPS62360=y
+CONFIG_REGULATOR_TPS65090=y
+CONFIG_REGULATOR_TPS6586X=y
+CONFIG_REGULATOR_TPS65910=y
+CONFIG_MEDIA_SUPPORT=y
+CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_MEDIA_USB_SUPPORT=y
+CONFIG_USB_VIDEO_CLASS=y
+CONFIG_USB_GSPCA=y
+CONFIG_DRM=y
+CONFIG_DRM_TEGRA=y
+CONFIG_DRM_PANEL_SIMPLE=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+# CONFIG_BACKLIGHT_GENERIC is not set
+CONFIG_BACKLIGHT_PWM=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
+CONFIG_LOGO=y
+CONFIG_SOUND=y
+CONFIG_SND=y
+# CONFIG_SND_SUPPORT_OLD_API is not set
+# CONFIG_SND_DRIVERS is not set
+# CONFIG_SND_ARM is not set
+# CONFIG_SND_SPI is not set
+# CONFIG_SND_USB is not set
+CONFIG_SND_SOC=y
+CONFIG_SND_SOC_TEGRA=y
+CONFIG_SND_SOC_TEGRA_RT5640=y
+CONFIG_SND_SOC_TEGRA_WM8753=y
+CONFIG_SND_SOC_TEGRA_WM8903=y
+CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
+CONFIG_SND_SOC_TEGRA_ALC5632=y
+CONFIG_SND_SOC_TEGRA_MAX98090=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
+CONFIG_USB_ACM=y
+CONFIG_USB_WDM=y
+CONFIG_USB_STORAGE=y
+CONFIG_MMC=y
+CONFIG_MMC_BLOCK_MINORS=16
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MMC_SDHCI_TEGRA=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_PWM=y
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_ONESHOT=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_GPIO=y
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+CONFIG_LEDS_TRIGGER_TRANSIENT=y
+CONFIG_LEDS_TRIGGER_CAMERA=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_AS3722=y
+CONFIG_RTC_DRV_DS1307=y
+CONFIG_RTC_DRV_MAX8907=y
+CONFIG_RTC_DRV_PALMAS=y
+CONFIG_RTC_DRV_TPS6586X=y
+CONFIG_RTC_DRV_TPS65910=y
+CONFIG_RTC_DRV_EM3027=y
+CONFIG_RTC_DRV_TEGRA=y
+CONFIG_DMADEVICES=y
+CONFIG_TEGRA20_APB_DMA=y
+CONFIG_STAGING=y
+CONFIG_SENSORS_ISL29018=y
+CONFIG_SENSORS_ISL29028=y
+CONFIG_MFD_NVEC=y
+CONFIG_KEYBOARD_NVEC=y
+CONFIG_SERIO_NVEC_PS2=y
+CONFIG_NVEC_POWER=y
+CONFIG_NVEC_PAZ00=y
+CONFIG_TEGRA_IOMMU_GART=y
+CONFIG_TEGRA_IOMMU_SMMU=y
+CONFIG_MEMORY=y
+CONFIG_IIO=y
+CONFIG_AK8975=y
+CONFIG_PWM=y
+CONFIG_PWM_TEGRA=y
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+CONFIG_EXT2_FS_POSIX_ACL=y
+CONFIG_EXT2_FS_SECURITY=y
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+CONFIG_EXT3_FS_POSIX_ACL=y
+CONFIG_EXT3_FS_SECURITY=y
+CONFIG_EXT4_FS=y
+# CONFIG_DNOTIFY is not set
+CONFIG_VFAT_FS=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_SQUASHFS=y
+CONFIG_SQUASHFS_LZO=y
+CONFIG_SQUASHFS_XZ=y
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_FS=y
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_SLAB=y
+CONFIG_DEBUG_VM=y
+CONFIG_DETECT_HUNG_TASK=y
+CONFIG_SCHEDSTATS=y
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_PREEMPT is not set
+CONFIG_DEBUG_MUTEXES=y
+CONFIG_DEBUG_SG=y
+CONFIG_DEBUG_LL=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_CRYPTO_TWOFISH=y
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRC_CCITT=y
--
2.1.0

Patch 2

From 771a2c84aef4755b52d21ebcc71505a1db78e88d Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob.mottram@codethink.co.uk>
Date: Thu, 8 Jan 2015 17:31:57 +0000
Subject: [PATCH 2/4] ARM: gpio: tegra: Maintain endianness

Replace the _raw-writel with writel_relaxed to fix issue with
running tegra in big-endian. Tested on Jetson TK1.

Signed-off-by: Bob Mottram <bob.mottram@codethink.co.uk>
---
 drivers/gpio/gpio-tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 1741981..a83e140 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -85,12 +85,12 @@ static struct tegra_gpio_bank *tegra_gpio_banks;

 static inline void tegra_gpio_writel(u32 val, u32 reg)
 {
-   __raw_writel(val, regs + reg);
+   writel_relaxed(val, regs + reg);
 }

 static inline u32 tegra_gpio_readl(u32 reg)
 {
-   return __raw_readl(regs + reg);
+   return readl_relaxed(regs + reg);
 }

 static int tegra_gpio_compose(int bank, int port, int bit)
--
2.1.0

Patch 3

From d58e8fcf3fabc0e312512bc1ca2347c30ede83c8 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob.mottram@codethink.co.uk>
Date: Thu, 8 Jan 2015 17:35:38 +0000
Subject: [PATCH 3/4] ARM: tegra: enable big-endian support

Config changes to enable big-endian support. Tested on Jetson TK1.

Signed-off-by: Bob Mottram <bob.mottram@codethink.co.uk>
---
 arch/arm/mach-tegra/Kconfig   | 1 +
 arch/arm/mach-tegra/headsmp.S | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index d0be9a1..d8cb963 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -2,6 +2,7 @@ menuconfig ARCH_TEGRA
    bool "NVIDIA Tegra" if ARCH_MULTI_V7
    select ARCH_REQUIRE_GPIOLIB
    select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
+   select ARCH_SUPPORTS_BIG_ENDIAN
    select ARM_AMBA
    select ARM_GIC
    select CLKSRC_MMIO
diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
index 2072e73..9896981 100644
--- a/arch/arm/mach-tegra/headsmp.S
+++ b/arch/arm/mach-tegra/headsmp.S
@@ -1,11 +1,12 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
-
+#include <asm/assembler.h>
 #include "sleep.h"

         .section ".text.head", "ax"

 ENTRY(tegra_secondary_startup)
+        ARM_BE8(setend    be)
         check_cpu_part_num 0xc09, r8, r9
         bleq    v7_invalidate_l1
         b       secondary_startup
--
2.1.0

Patch 4

From 4bc70eab66c03b214649cc8af8d76d80f353b391 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob.mottram@codethink.co.uk>
Date: Thu, 8 Jan 2015 17:37:15 +0000
Subject: [PATCH 4/4] ARM: tegra: fix big-endian issue with irq code

Replace the _raw-writel with writel_relaxed to fix issue with
running tegra in big-endian. Tested on Jetson TK1.

Signed-off-by: Bob Mottram <bob.mottram@codethink.co.uk>
---
 arch/arm/mach-tegra/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index ab95f53..f4c2857 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -94,7 +94,7 @@ static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg)
    base = ictlr_reg_base[(irq - FIRST_LEGACY_IRQ) / 32];
mask = BIT((irq - FIRST_LEGACY_IRQ) % 32);

-   __raw_writel(mask, base + reg);
+   writel_relaxed(mask, base + reg);
 }

 static void tegra_mask(struct irq_data *d)
--
2.1.0