Skip to content

Commit

Permalink
machine: add toradex apalis imx6 board configs (#2)
Browse files Browse the repository at this point in the history
* Add toradex apalis imx6 board configs

* Disable firmware for toradex apalis imx6

* Add build for toradex apalis imx6 minimal image into TravisCI
  • Loading branch information
deadloko authored and Michael Eden committed Apr 24, 2019
1 parent 8bbcb7e commit bb3c442
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ script: |
cachix push cross-armed $(nix-store -qd result)
fi
# build a toradex apalis imx6 sample image
nix-build . \
--cores 2 \
--max-jobs 2 \
--no-build-output \
-I nixpkgs=nixpkgs \
-I machine=machines/toradex_apalis_imx6 \
-I image=images/minimal
# push toradex apalis imx6 with permission
if [[ ${CACHIX_AUTH_TOKEN:-} ]]; then
cachix push cross-armed $(readlink -f result)
cachix push cross-armed $(nix-store -qd result)
fi
# kill the background process
kill %1
)
62 changes: 62 additions & 0 deletions machines/toradex_apalis_imx6/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{ config, pkgs, ... }:
let
toradex_apalis_imx6 = import ./system.nix;
in
{
# specify the system we're compiling to
nixpkgs.crossSystem = toradex_apalis_imx6;

# enable free firmware
hardware.enableRedistributableFirmware = false;

# specify a good kernel version
boot.kernelPackages = pkgs.linuxPackages_5_0;

# do our own boot-loader
boot.loader.grub.enable = false;
boot.loader.systemd-boot.enable = false;
boot.loader.generic-extlinux-compatible.enable = false;

# build & install boot loader
sdImage.populateBootCommands = let
kernel = toradex_apalis_imx6.platform.kernelTarget;
init = "${config.system.build.toplevel}/init";
root = "/dev/mmcblk2p2";
uboot = pkgs.buildUBoot {
defconfig = "apalis_imx6_defconfig";
extraMeta.platforms = [toradex_apalis_imx6.system];
filesToInstall = ["SPL" "u-boot.img"];
};
uEnv = pkgs.writeText "uEnv.txt" ''
bootdir=
bootcmd=run uenvcmd;
bootfile=${kernel}
fdtfile=${toradex_apalis_imx6.dtb}
loadaddr=0x11000000
fdtaddr=0x12000000
loadfdt=load mmc 0:1 ''${fdtaddr} ''${fdtfile}
loaduimage=load mmc 0:1 ''${loadaddr} ''${bootfile}
uenvcmd=mmc rescan; run loaduimage; run loadfdt; run fdtboot
fdtboot=run mmc_args; bootz ''${loadaddr} - ''${fdtaddr}
mmc_args=setenv bootargs console=''${console} ''${optargs} root=${root} rootfstype=ext4 init=${init}
'';

# Populate result/nix-support/tezi folder for ToradexEasyInstaller.
populateToradexTezi = ''
mkdir -p $out/nix-support/tezi/
cp ${uboot}/SPL $out/nix-support/tezi/
cp ${uboot}/u-boot.img $out/nix-support/tezi/
cp ${config.boot.kernelPackages.kernel}/${kernel} $out/nix-support/tezi/
cp ${config.boot.kernelPackages.kernel}/dtbs/${toradex_apalis_imx6.dtb} $out/nix-support/tezi/
cp ${uEnv} $out/nix-support/tezi/uEnv.txt
'';

in ''
${populateToradexTezi}
cp ${uboot}/SPL boot/
cp ${uboot}/u-boot.img boot/
cp ${config.boot.kernelPackages.kernel}/${kernel} boot/
cp ${config.boot.kernelPackages.kernel}/dtbs/${toradex_apalis_imx6.dtb} boot/
cp ${uEnv} boot/uEnv.txt
'';
}
22 changes: 22 additions & 0 deletions machines/toradex_apalis_imx6/system.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
with builtins;
{
config = "armv7l-unknown-linux-gnueabihf";
system = "armv7l-linux";
platform = {
name = "toradex_apalis_imx6";
kernelBaseConfig = "imx_v6_v7_defconfig";
kernelAutoModules = false;
kernelTarget = "zImage";
kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
kernelArch = "arm";
kernelDTB = true;
kernelPreferBuiltin = true;
kernelExtraConfig = ''
'';
gcc = {
cpu = "cortex-a9";
fpu = "neon";
};
};
dtb = "imx6q-apalis-eval.dtb";
}

0 comments on commit bb3c442

Please sign in to comment.