arm-sdk

os build toolkit for various embedded devices
git clone https://git.parazyd.org/arm-sdk
Log | Files | Refs | Submodules | README | LICENSE

ouya.sh (3148B)


      1 #!/usr/bin/env zsh
      2 # Copyright (c) 2016-2021 Ivan J. <parazyd@dyne.org>
      3 # This file is part of arm-sdk
      4 #
      5 # This source code is free software: you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as published by
      7 # the Free Software Foundation, either version 3 of the License, or
      8 # (at your option) any later version.
      9 #
     10 # This software is distributed in the hope that it will be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this source code. If not, see <http://www.gnu.org/licenses/>.
     17 
     18 ## kernel build script for OUYA Game console
     19 ## NOTE: see 'doc/quirks.md' for more info on this device
     20 
     21 ## settings & config
     22 vars+=(device_name arch size parted_boot parted_root bootfs inittab)
     23 vars+=(gitkernel gitbranch)
     24 arrs+=(custmodules)
     25 
     26 device_name="ouya"
     27 arch="armhf"
     28 size=1337
     29 inittab=("T0:2345:respawn:/sbin/getty -L ttyS0 115200 linux")
     30 
     31 parted_type="dos"
     32 bootfs="vfat"
     33 rootfs="ext4"
     34 dos_boot="fat32 2048s 264191s"
     35 dos_root="$rootfs 264192s 100%"
     36 
     37 extra_packages+=(libasound2 libglib2.0-0 libgstreamer-plugins-base0.10-0 libxv1)
     38 custmodules=()
     39 
     40 
     41 prebuild() {
     42 	fn prebuild
     43 	req=(device_name strapdir)
     44 	ckreq || return 1
     45 
     46 	notice "executing $device_name prebuild"
     47 
     48 	copy-root-overlay
     49 
     50 	cat <<EOF | sudo tee ${strapdir}/etc/fstab
     51 # <file system> <mount point> <type> <options> <dump> <pass>
     52 /dev/sda2 / ext4 noatime,errors=remount-ro 0 1
     53 tmpfs /tmp tmpfs defaults 0 0
     54 EOF
     55 
     56 	notice "copying some kernel modules"
     57 	sudo cp -ra $R/extra/ouya/3.1.10-tk3+ $strapdir/lib/modules/
     58 
     59 	print 1 | sudo tee $strapdir/boot/.keep
     60 }
     61 
     62 postbuild() {
     63 	fn postbuild
     64 	req=(strapdir)
     65 	ckreq || return 1
     66 
     67 	notice "executing $device_name postbuild"
     68 
     69 	sudo mkdir -p $strapdir/ouya
     70 	sudo cp -f $R/extra/ouya/*.deb $strapdir/ouya/
     71 
     72 	cat <<EOF | sudo tee ${strapdir}/ouya.sh
     73 #!/bin/sh
     74 for deb in /ouya/*.deb; do
     75 	dpkg -i \$deb
     76 	apt-get -f --yes --force-yes install
     77 done
     78 rm -rf /ouya
     79 EOF
     80 
     81 	chroot-script -d ouya.sh || zerr
     82 
     83 	postbuild-clean
     84 }
     85 build_kernel_armhf() {
     86 	fn build_kernel_armhf
     87 	req+=(workdir strapdir)
     88 	ckreq || return 1
     89 
     90 	notice "building $arch kernel"
     91 
     92 	prebuild || zerr
     93 
     94 	cat <<EOM
     95 	#############################################################################
     96 	# This device is a bit strange, because I do not want people to flash it on #
     97 	# the device's NAND. You will brick it. Instead, we use the device's kernel #
     98 	# and boot this image from a USB flash drive.                               #
     99 	#                                                                           #
    100 	# Consult doc/quirks.md to find out how to boot this.                       #
    101 	#                                                                           #
    102 	# https://github.com/kulve/tegra-debian                                     #
    103 	# http://tuomas.kulve.fi/blog/2013/09/12/debian-on-ouya-all-systems-go/     #
    104 	#############################################################################
    105 EOM
    106 	sleep 5
    107 
    108 	postbuild || zerr
    109 }