├── oem ├── meta │ ├── readme.md │ ├── odroid-c1.png │ └── package.yaml └── boot-assets │ ├── uEnv.txt │ └── uboot.env.in ├── device ├── modprobe.d │ └── blacklist_w1.conf └── hardware.yaml ├── .gitignore ├── common.mk ├── u-boot.mk ├── Makefile ├── oem.mk ├── linux.mk ├── scripts └── resize-snappy-writable.sh ├── device.mk └── README.md /oem/meta/readme.md: -------------------------------------------------------------------------------- 1 | ODROIDC support package 2 | Support files for booting ODROIDC 3 | -------------------------------------------------------------------------------- /device/modprobe.d/blacklist_w1.conf: -------------------------------------------------------------------------------- 1 | # Don't load the wire interface bus master 2 | blacklist w1_gpio 3 | -------------------------------------------------------------------------------- /oem/meta/odroid-c1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/longsleep/snappy-odroidc/HEAD/oem/meta/odroid-c1.png -------------------------------------------------------------------------------- /device/hardware.yaml: -------------------------------------------------------------------------------- 1 | kernel: assets/uImage 2 | dtbs: assets/dtbs 3 | initrd: assets/uInitrd 4 | partition-layout: system-AB 5 | bootloader: u-boot 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | u-boot/ 2 | oem/boot-assets/bl1-*.bin 3 | oem/boot-assets/u-boot.bin 4 | oem/boot-assets/uboot.env 5 | oem/boot-assets/logo.bmp 6 | *.snap 7 | *.tar.xz 8 | linux/ 9 | *.img 10 | device/assets/ 11 | device/preinstalled.tar.gz 12 | device/preinstalled/ 13 | device/ramdisk/ 14 | device/system/ 15 | device/initrd/ 16 | -------------------------------------------------------------------------------- /common.mk: -------------------------------------------------------------------------------- 1 | CPUS := $(shell getconf _NPROCESSORS_ONLN) 2 | 3 | OUTPUT_DIR := $(PWD) 4 | 5 | UBOOT_REPO := https://github.com/longsleep/u-boot-odroidc.git 6 | UBOOT_BRANCH := master 7 | UBOOT_SRC := $(PWD)/u-boot 8 | UBOOT_BIN := $(UBOOT_SRC)/sd_fuse/u-boot.bin 9 | UBOOT_MKENVIMAGE := $(UBOOT_SRC)/build/tools/mkenvimage 10 | 11 | LINUX_REPO := https://github.com/longsleep/ubuntu-odroidc.git 12 | LINUX_BRANCH := master 13 | LINUX_SRC := $(PWD)/linux 14 | LINUX_UIMAGE := $(LINUX_SRC)/arch/arm/boot/uImage 15 | LINUX_DTB := $(LINUX_SRC)/arch/arm/boot/dts/meson8b_odroidc.dtb 16 | LINUX_MODULES := $(LINUX_SRC)/modules 17 | 18 | -------------------------------------------------------------------------------- /u-boot.mk: -------------------------------------------------------------------------------- 1 | include common.mk 2 | 3 | CC := /usr/bin/arm-linux-gnueabihf- 4 | 5 | all: build 6 | 7 | clean: 8 | if test -d "$(UBOOT_SRC)" ; then $(MAKE) ARCH=arm CROSS_COMPILE=${CC} -C $(UBOOT_SRC) clean ; fi 9 | rm -f $(UBOOT_BIN) 10 | 11 | distclean: 12 | rm -rf $(wildcard $(UBOOT_SRC)) 13 | 14 | $(UBOOT_BIN): $(UBOOT_SRC) 15 | $(MAKE) ARCH=arm CROSS_COMPILE=${CC} -C $(UBOOT_SRC) odroidc_config 16 | $(MAKE) ARCH=arm CROSS_COMPILE=${CC} -C $(UBOOT_SRC) -j$(CPUS) 17 | touch $@ 18 | 19 | $(UBOOT_SRC): 20 | git clone --depth=1 $(UBOOT_REPO) -b $(UBOOT_BRANCH) u-boot 21 | 22 | u-boot: $(UBOOT_BIN) 23 | 24 | build: u-boot 25 | 26 | .PHONY: u-boot build 27 | -------------------------------------------------------------------------------- /oem/meta/package.yaml: -------------------------------------------------------------------------------- 1 | name: odroidc 2 | vendor: Simon Eisenmann 3 | icon: meta/odroid-c1.png 4 | version: 0.6 5 | type: oem 6 | 7 | config: 8 | ubuntu-core: 9 | hostname: odroid 10 | oem: 11 | branding: 12 | name: ODROIDC 13 | hardware: 14 | platform: meson8b_odroidc 15 | architecture: armhf 16 | partition-layout: system-AB 17 | bootloader: u-boot 18 | boot-assets: 19 | files: 20 | - path: boot-assets/uEnv.txt 21 | - path: boot-assets/uboot.env 22 | raw-files: 23 | - path: boot-assets/bl1-0.bin 24 | offset: 0 25 | - path: boot-assets/bl1-1.bin 26 | offset: 512 # 512 * 1 27 | - path: boot-assets/u-boot.bin 28 | offset: 32768 # 512 * 64 29 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | BUILD_STEPS := u-boot linux oem device 3 | 4 | all: build 5 | 6 | pre-u-boot: 7 | pre-linux: 8 | pre-oem: build-u-boot 9 | pre-device: build-linux 10 | 11 | define BUILD_STEPS_TEMPLATE 12 | build-$(1): pre-$(1) 13 | $$(MAKE) -f $(1).mk build 14 | clean-$(1): 15 | $$(MAKE) -f $(1).mk clean 16 | distclean-$(1): 17 | $$(MAKE) -f $(1).mk distclean 18 | .PHONY: pre-$(1) build-$(1) clean-$(1) distclean-$(1) 19 | endef 20 | 21 | $(foreach step,$(BUILD_STEPS),$(eval $(call BUILD_STEPS_TEMPLATE,$(step)))) 22 | 23 | build: $(addprefix build-,$(BUILD_STEPS)) 24 | 25 | clean: $(addprefix clean-,$(BUILD_STEPS)) 26 | 27 | distclean: $(addprefix distclean-,$(BUILD_STEPS)) 28 | 29 | u-boot: build-u-boot 30 | 31 | linux: build-linux 32 | 33 | oem: build-oem 34 | 35 | device: build-device 36 | 37 | .PHONY: all build clean distclean u-boot linux oem device -------------------------------------------------------------------------------- /oem.mk: -------------------------------------------------------------------------------- 1 | include common.mk 2 | 3 | BL1 := $(UBOOT_SRC)/sd_fuse/bl1.bin.hardkernel 4 | BL1_0 := oem/boot-assets/bl1-0.bin 5 | BL1_1 := oem/boot-assets/bl1-1.bin 6 | 7 | OEM_UBOOT_BIN := oem/boot-assets/u-boot.bin 8 | OEM_UBOOT_ENV := oem/boot-assets/uboot.env 9 | 10 | all: build 11 | 12 | clean: 13 | rm -f $(BL1_0) $(BL1_1) $(OEM_UBOOT_BIN) $(OEM_UBOOT_ENV) 14 | 15 | $(BL1_0): 16 | dd if=$(BL1) of=$@ bs=1 count=442 conv=notrunc 17 | 18 | $(BL1_1): 19 | dd if=$(BL1) of=$@ bs=512 skip=1 conv=notrunc 20 | 21 | u-boot: 22 | @if [ ! -f $(UBOOT_BIN) ] ; then echo "Build u-boot first."; exit 1; fi 23 | cp -f $(UBOOT_BIN) $(OEM_UBOOT_BIN) 24 | 25 | bl: $(BL1_0) $(BL1_1) u-boot 26 | 27 | env: 28 | @if [ ! -f $(UBOOT_MKENVIMAGE) ] ; then echo "Build u-boot first."; exit 1; fi 29 | $(UBOOT_MKENVIMAGE) -r -s 131072 -o $(OEM_UBOOT_ENV) $(OEM_UBOOT_ENV).in 30 | 31 | snappy: env 32 | cd oem && snappy build -o $(OUTPUT_DIR) . 33 | 34 | oem: bl snappy 35 | 36 | build: oem 37 | 38 | .PHONY: u-boot bl env snappy oem build 39 | -------------------------------------------------------------------------------- /oem/boot-assets/uEnv.txt: -------------------------------------------------------------------------------- 1 | 2 | # Screen resolution (default=720p) 3 | #m=vga 4 | #m=480p 5 | #m=576p 6 | #m=800x480p60hz 7 | #m=800x600p60hz 8 | #m=1024x600p60hz 9 | #m=1024x768p60hz 10 | #m=1360x768p60hz 11 | #m=1366x768p60hz 12 | #m=1440x900p60hz 13 | #m=1600x900p60hz 14 | #m=1680x1050p60hz 15 | #m=720p 16 | #m=800p 17 | #m=sxga 18 | m=1080p 19 | #m=1920x1200 20 | 21 | # Video mode (default=hdmi) 22 | vout_mode=hdmi 23 | #vout_mode=dvi 24 | 25 | # Video bpp (default=32) 26 | m_bpp=32 27 | #m_bpp=24 28 | #m_bpp=16 29 | 30 | # Enable HDMI hot plug (HPD, default=1) 31 | # 1 = enabled 32 | # 0 = disabled (forces connected status) 33 | hpd=1 34 | 35 | # Enable HDMI CEC support (default=0) 36 | # 1 = enabled 37 | # 0 = disabled 38 | cec=0 39 | 40 | # Uncomment the line below to disable UHS-1 MicroSD support 41 | # disableuhs=disableuhs 42 | 43 | # Enable video decoding engine (default=1) 44 | # 1 = enabled 45 | # 0 = disabled 46 | vpu=0 47 | 48 | # Enable HDMI output (default=1) 49 | # 1 = enabled 50 | # 0 = disabled 51 | hdmioutput=0 52 | -------------------------------------------------------------------------------- /linux.mk: -------------------------------------------------------------------------------- 1 | include common.mk 2 | 3 | CC := /usr/bin/arm-linux-gnueabihf- 4 | 5 | all: build 6 | 7 | clean: 8 | if test -d "$(LINUX_SRC)" ; then $(MAKE) -C $(LINUX_SRC) mrproper ; fi 9 | rm -f $(INITRD_IMG) $(LINUX_UIMAGE) $(LINUX_DTB) 10 | rm -rf $(LINUX_MODULES) 11 | 12 | distclean: 13 | rm -rf $(wildcard $(LINUX_SRC) $(INITRD_SRC)) 14 | 15 | $(LINUX_SRC): 16 | @git clone --depth=1 $(LINUX_REPO) -b $(LINUX_BRANCH) linux 17 | 18 | $(LINUX_SRC)/.config: $(LINUX_SRC) 19 | $(MAKE) ARCH=arm CROSS_COMPILE=$(CC) -C $(LINUX_SRC) snappy_odroidc_defconfig 20 | 21 | $(LINUX_UIMAGE): $(LINUX_SRC)/.config 22 | @rm -f $(LINUX_SRC)/arch/arm/boot/zImage 23 | @rm -f $(LINUX_UIMAGE) 24 | $(MAKE) ARCH=arm CROSS_COMPILE=$(CC) -C $(LINUX_SRC) -j$(CPUS) uImage 25 | 26 | $(LINUX_DTB): $(LINUX_SRC)/.config 27 | $(MAKE) ARCH=arm CROSS_COMPILE=$(CC) -C $(LINUX_SRC) -j$(CPUS) dtbs 28 | 29 | config: $(LINUX_SRC)/.config 30 | 31 | kernel: $(LINUX_UIMAGE) 32 | 33 | dtb: $(LINUX_DTB) 34 | 35 | modules: $(LINUX_SRC)/.config 36 | $(MAKE) ARCH=arm CROSS_COMPILE=$(CC) -C $(LINUX_SRC) -j$(CPUS) modules 37 | 38 | linux: kernel dtb modules 39 | @rm -rf $(LINUX_MODULES) 40 | $(MAKE) ARCH=arm CROSS_COMPILE=$(CC) -C $(LINUX_SRC) -j$(CPUS) INSTALL_MOD_PATH=$(LINUX_MODULES) INSTALL_MOD_STRIP=1 modules_install 41 | 42 | build: linux 43 | 44 | .PHONY: kernel dtb modules linux build 45 | -------------------------------------------------------------------------------- /scripts/resize-snappy-writable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Simple script to resize the writable paritition of a Ubuntu Snappy system 4 | # to the maximum possible value of the underlaying storage device. 5 | # 6 | # Author : Simon Eisenmann 7 | # License : BSD-3-Clause http://opensource.org/licenses/BSD-3-Clause 8 | # 9 | # Copyright (c) 2015, struktur AG 10 | # All rights reserved. 11 | # 12 | # Redistribution and use in source and binary forms, with or without 13 | # modification, are permitted provided that the following conditions are met: 14 | # 15 | # 1. Redistributions of source code must retain the above copyright notice, 16 | # this list of conditions and the following disclaimer. 17 | # 18 | # 2. Redistributions in binary form must reproduce the above copyright notice, 19 | # this list of conditions and the following disclaimer in the documentation 20 | # and/or other materials provided with the distribution. 21 | # 22 | # 3. Neither the name of the copyright holder nor the names of its 23 | # contributors may be used to endorse or promote products derived from this 24 | # software without specific prior written permission. 25 | # 26 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 30 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | # POSSIBILITY OF SUCH DAMAGE. 37 | 38 | set -e 39 | DEVNAME=$(blkid -L writable) 40 | echo DEVNAME=$DEVNAME 41 | DEV=$(basename $DEVNAME) 42 | echo DEV=$DEV 43 | BLOCKPATH=/sys/class/block/$DEV 44 | echo BLOCKPATH=$BLOCKPATH 45 | PARTITION=$(cat $BLOCKPATH/partition) 46 | echo PARTITION=$PARTITION 47 | REALPATH=$(realpath $BLOCKPATH) 48 | echo REALPATH=$REALPATH 49 | PARENTPATH=$(dirname $REALPATH) 50 | echo PARENTPATH=$PARENTPATH 51 | BLK=$(cat $PARENTPATH/dev) 52 | echo BLK=$BLK 53 | BLKDEV=$(realpath /dev/block/$BLK) 54 | echo BLKDEV=$BLKDEV 55 | set +e 56 | growpart --fudge 20480 -u auto $BLKDEV $PARTITION 57 | resize2fs $DEVNAME 58 | -------------------------------------------------------------------------------- /oem/boot-assets/uboot.env.in: -------------------------------------------------------------------------------- 1 | display_bpp=24 2 | display_color_bg=0 3 | display_color_fg=0xffff 4 | display_color_format_index=24 5 | display_width=1920 6 | display_height=1080 7 | display_layer=osd2 8 | fb_width=1280 9 | fb_height=720 10 | firstboot=1 11 | outputmode=720p 12 | hdmimode=720p 13 | logo_addr=0x14000000 14 | preloadlogo=logo size ${outputmode}; video open; video clear; video dev open ${outputmode}; fatload mmc ${mmcdev}:${mmcpart} ${logo_addr} ${logo_file}; bmp display ${logo_addr}; bmp scale 15 | logo_file=logo.bmp 16 | video_dev=tvout 17 | baudrate=115200 18 | boardname=ODROIDC 19 | bootcmd=run mmcboot 20 | bootdelay=1 21 | bootstart=0 22 | chipname=8726m8 23 | console=console=ttyS0,115200n8 24 | load_addr=0x12000000 25 | kernel_addr=0x21000000 26 | initrd_addr=0x22000000 27 | fdt_addr=0x21800000 28 | fb_addr=0x7900000 29 | cvbsmode=576cvbs 30 | m=720p 31 | vout_mode=hdmi 32 | vpu=1 33 | hdmioutput=1 34 | hpd=1 35 | cec=0 36 | vdaccfg=0xa000 37 | m_bpp=32 38 | mmcdev=0 39 | mmcpart=1 40 | bootenv_file=uEnv.txt 41 | kernel_file=vmlinuz 42 | initrd_file=initrd.img 43 | fdt_file=meson8b_odroidc.dtb 44 | loadbootenv=fatload mmc ${mmcdev}:${mmcpart} ${load_addr} ${bootenv_file} 45 | importbootenv=echo Importing loaded environment ...; env import -t ${load_addr} ${filesize} 46 | loadfiles=run loadkernel; run loadinitrd; run loadfdt 47 | loadkernel=fatload mmc ${mmcdev}:${mmcpart} ${kernel_addr} ${snappy_ab}/${kernel_file} 48 | loadinitrd=fatload mmc ${mmcdev}:${mmcpart} ${initrd_addr} ${snappy_ab}/${initrd_file}; setenv initrd_size ${filesize} 49 | loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${snappy_ab}/dtbs/${fdt_file} 50 | mmcboot=if run loadbootenv; then echo Loaded environment from ${bootenv_file}; run importbootenv; fi; echo "Booting ..."; run snappy_boot 51 | mmcargs=setenv bootargs root=${mmcroot} ${snappy_cmdline} ${console} no_console_suspend vdaccfg=${vdaccfg} logo=osd1,loaded,${fb_addr},720p,full dmfc=3 cvbsmode=${cvbsmode} hdmimode=${m} m_bpp=${m_bpp} vout=${vout_mode} ${disableuhs} ${hdmi_hpd} ${hdmi_cec} 52 | setuphpd=if test "${hpd}" = "0"; then setenv hdmi_hpd "disablehpd=true"; fi 53 | setupcec=if test "${cec}" = "1"; then setenv hdmi_cec "hdmitx=cecf"; fi 54 | setupfdt=fdt addr ${fdt_addr}; if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi; if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi 55 | setup=run setuphpd; run setupcec; run setupfdt 56 | snappy_ab=a 57 | snappy_boot=if test "${snappy_mode}" = "try"; then if test "${snappy_trial_boot}" = "1"; then if test "${snappy_ab}" = "a"; then setenv snappy_ab "b"; else setenv snappy_ab "a"; fi; else setenv snappy_trial_boot "1"; saveenv; fi; fi; run loadfiles; setenv mmcroot "/dev/disk/by-label/system-${snappy_ab}"; run setup; run mmcargs; bootm ${kernel_addr} ${initrd_addr}:${initrd_size} ${fdt_addr} 58 | snappy_cmdline=init=/lib/systemd/systemd ro panic=-1 fixrtc net.ifnames=1 59 | snappy_mode=regular 60 | snappy_trial_boot=0 61 | -------------------------------------------------------------------------------- /device.mk: -------------------------------------------------------------------------------- 1 | include common.mk 2 | 3 | DEVICE_VERSION := "0.5" 4 | DEVICE_PREINSTALLED := http://cdimage.ubuntu.com/ubuntu-core/vivid/daily-preinstalled/current/vivid-preinstalled-core-armhf.device.tar.gz 5 | 6 | DEVICE_SRC := $(PWD)/device 7 | DEVICE_UIMAGE := $(DEVICE_SRC)/assets/uImage 8 | DEVICE_DTBS := $(DEVICE_SRC)/assets/dtbs 9 | DEVICE_INITRD := $(DEVICE_SRC)/initrd 10 | DEVICE_INITRD_IMG := $(DEVICE_SRC)/initrd.img 11 | DEVICE_UINITRD := $(DEVICE_SRC)/assets/uInitrd 12 | DEVICE_MODULES := $(DEVICE_SRC)/system 13 | DEVICE_MODPROBE_D := $(DEVICE_SRC)/system/lib/modprobe.d 14 | DEVICE_FIRMWARE := $(DEVICE_SRC)/system/lib/firmware 15 | DEVICE_TAR := $(PWD)/device-odroidc_$(DEVICE_VERSION).tar.xz 16 | 17 | all: build 18 | 19 | clean: 20 | rm -f $(DEVICE_UIMAGE) $(DEVICE_UINITRD) $(DEVICE_INITRD_IMG) 21 | rm -rf $(DEVICE_DTBS) 22 | rm -rf $(DEVICE_MODULES) 23 | rm -rf $(DEVICE_INITRD) 24 | rm -rf $(DEVICE_SRC)/preinstalled 25 | rm -rf $(DEVICE_MODPROBE_D) 26 | 27 | distclean: 28 | rm -rf $(DEVICE_SRC)/preinstalled.tar.gz 29 | 30 | $(DEVICE_SRC): 31 | mkdir -p $(DEVICE_SRC) 32 | 33 | $(DEVICE_UIMAGE): 34 | @if [ ! -f $(LINUX_UIMAGE) ] ; then echo "Build linux first."; exit 1; fi 35 | @mkdir -p $(DEVICE_SRC)/assets 36 | cp -f $(LINUX_UIMAGE) $(DEVICE_UIMAGE) 37 | 38 | $(DEVICE_UINITRD): $(DEVICE_INITRD_IMG) 39 | @mkdir -p $(DEVICE_SRC)/assets 40 | @rm -f $(DEVICE_UINITRD) 41 | mkimage -A arm -T ramdisk -C none -n "Snappy Initrd" -d $(DEVICE_INITRD_IMG) $(DEVICE_UINITRD) 42 | 43 | $(DEVICE_INITRD_IMG): preinstalled 44 | @rm -f $(DEVICE_INITRD_IMG) 45 | @rm -rf $(DEVICE_INITRD) 46 | @mkdir -p $(DEVICE_INITRD) 47 | lzcat $(DEVICE_SRC)/preinstalled/initrd.img | ( cd $(DEVICE_INITRD); cpio -i ) 48 | @rm -rf $(DEVICE_INITRD)/lib/modules 49 | @rm -rf $(DEVICE_INITRD)/lib/firmware 50 | ( cd $(DEVICE_INITRD); find | sort | cpio --quiet -o -H newc ) | lzma > $(DEVICE_INITRD_IMG) 51 | 52 | $(DEVICE_SRC)/preinstalled.tar.gz: | $(DEVICE_SRC) 53 | @wget $(DEVICE_PREINSTALLED) -O $@ 54 | 55 | preinstalled: $(DEVICE_SRC)/preinstalled.tar.gz 56 | @rm -rf $(DEVICE_SRC)/preinstalled 57 | @mkdir -p $(DEVICE_SRC)/preinstalled 58 | tar xzvf $< -C $(DEVICE_SRC)/preinstalled --wildcards 'system/boot/initrd.img-*' --wildcards 'system/lib/firmware/*' 59 | cp $(DEVICE_SRC)/preinstalled/system/boot/initrd.img-* $(DEVICE_SRC)/preinstalled/initrd.img 60 | 61 | dtbs: 62 | @if [ ! -f $(LINUX_DTB) ] ; then echo "Build linux first."; exit 1; fi 63 | @mkdir -p $(DEVICE_DTBS) 64 | cp $(LINUX_DTB) $(DEVICE_DTBS) 65 | 66 | modules: 67 | @if [ ! -e $(LINUX_MODULES) ] ; then echo "Build linux first."; exit 1; fi 68 | @rm -rf $(DEVICE_MODULES) 69 | @mkdir -p $(DEVICE_MODULES) 70 | cp -a $(LINUX_MODULES)/* $(DEVICE_MODULES) 71 | 72 | modprobe.d: 73 | @rm -rf $(DEVICE_MODPROBE_D) 74 | @mkdir -p $(DEVICE_MODPROBE_D) 75 | cp -a $(DEVICE_SRC)/modprobe.d/* $(DEVICE_MODPROBE_D) 76 | 77 | firmware: 78 | rsync -rva --exclude "*-generic" $(DEVICE_SRC)/preinstalled/system/lib/firmware/ $(DEVICE_FIRMWARE)/ 79 | 80 | device: $(DEVICE_UIMAGE) $(DEVICE_UINITRD) dtbs modules modprobe.d firmware 81 | @rm -f $(DEVICE_TAR) 82 | tar -C $(DEVICE_SRC) -cavf $(DEVICE_TAR) --exclude ./preinstalled --exclude ./preinstalled.tar.gz --exclude ./initrd --exclude ./initrd.img --exclude ./modprobe.d --xform s:'./':: . 83 | 84 | build: device 85 | 86 | .PHONY: preinstalled dtbs modules device build $(DEVICE_INITRD_IMG) $(DEVICE_UIMAGE) 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ODRDOID Snappy builder 2 | 3 | Scripts to build [Ubuntu Snappy](http://developer.ubuntu.com/snappy/) OEM and device part for [ODROID C1](http://www.hardkernel.com/main/products/prdt_info.php?g_code=G141578608433). 4 | 5 | ## Requirements 6 | 7 | To build all parts, a couple of dependencies are required. On Ubuntu you can 8 | install all build dependencies with the following command. 9 | 10 | ```bash 11 | sudo apt-get install build-essential u-boot-tools lzop debootstrap debootstrap gcc-arm-linux-gnueabihf 12 | ``` 13 | 14 | ## Building 15 | 16 | A `Makefile` is provided to build U-Boot, Kernel and Initrd from source. The 17 | sources will be cloned into local folders if not there already. 18 | 19 | The U-Boot provided by Hardkernel is lacking features to support Ubuntu Snappy 20 | and is based on a very old U-Boot version. For now, i have backported the 21 | missing required features in [my own U-Boot tree](https://github.com/longsleep/u-boot-odroidc). 22 | 23 | Similar to U-Boot, the Kernel provided by Hardkernel is lacking latest 24 | AppArmor support. I have a [ODROIDC Kernel tree](https://github.com/longsleep/ubuntu-odroidc) 25 | with the changes for ODROIDC from Hardkernel merged together with AppArmor 26 | upstream. 27 | 28 | To build it all, just run `make`. This will produce a oem snap `odroidc_x.y_all.snap` 29 | and a `device-odroidc.tar.gz` device part, which can be used to build your own 30 | Ubuntu Snappy image for ODROID C1. 31 | 32 | ### Build OEM snap 33 | 34 | You can build the OEM snap seperately too. The OEM snap contains the U-Boot, 35 | so make sure you have build the U-Boot first with `make u-boot`. 36 | 37 | ```bash 38 | make oem 39 | ``` 40 | 41 | The OEM snap, contains also a boot.ini which overwrites certain variables to 42 | make Snappy work with the U-Boot v2011.03. This is quite hacky but for now 43 | seems to be the only possible option. In addition, the OEM snap contains the 44 | binary proprietary boot loader code which bootstraps the SOC. On build, this 45 | boot code is split up as required by the hardware platform. 46 | 47 | ### Build device part 48 | 49 | Of course the device part can be built seperately as well. The device part 50 | contains the Linux kernel and modules, so make sure to have built the Linux 51 | Kernel first with `make linux`. 52 | 53 | ```bash 54 | make device 55 | ``` 56 | 57 | The device part contains the Linux Kernel in the U-Boot compatible format, the 58 | compiled device tree, the Kernel modules and the initial ram disk. As there 59 | does not seem to be any reasonable way to build the initrd, it is extracted 60 | from the preinstalled Ubuntu Snappy Core tar and repacked without Kernel and 61 | modules. 62 | 63 | ## Build ODROID-C development image 64 | 65 | Make sure you have build the OEM snap and the device part first. You will also 66 | need to have the [snappy-tools](https://developer.ubuntu.com/en/snappy/start/) 67 | installed. Then you can simply create the image with `ubuntu-device-flash`. 68 | 69 | ```bash 70 | sudo ubuntu-device-flash core \ 71 | --channel stable \ 72 | --oem odroidc_0.5_all.snap \ 73 | --device-part device-odroidc_0.5.tar.xz \ 74 | --developer-mode \ 75 | -o odroidc-15.04-stable-dev.img \ 76 | 15.04 77 | ``` 78 | 79 | ## Build ODROID-C image for production 80 | 81 | To build an Ubuntu Snappy image without developer mode, the OEM snap needs to 82 | come from the store. The ODROID-C oem snap is available in the store as 83 | `odroidc.longsleep`. You still need to build a device tarball. 84 | 85 | ```bash 86 | sudo ubuntu-device-flash core \ 87 | --channel stable \ 88 | --oem odroidc.longsleep \ 89 | --device-part device-odroidc_0.5.tar.xz \ 90 | -o odroidc-15.04-stable.img \ 91 | 15.04 92 | ``` 93 | 94 | ## Flash to SD card 95 | 96 | Flash this to SD or eMMC and your ODROID will boot into Snappy. DHCP will be 97 | used for ethernet networking. Default user is `ubuntu` with password `ubuntu`. 98 | 99 | Enjoy! 100 | 101 | -- 102 | Simon Eisenmann --------------------------------------------------------------------------------