From 33e6f2c2bef3992acd91ac465955938f0292a430 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 28 Jun 2016 17:18:15 +0100 Subject: [PATCH] Beginning of support for odroid c2 --- README.md | 2 +- man/freedombone-image.1.gz | Bin 3377 -> 3383 bytes src/freedombone-image-hardware-setup | 237 ++++++++++++++++----------- src/freedombone-image-make | 16 ++ src/freedombone-image-makefile | 11 ++ 5 files changed, 173 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 49eb69d4..02377276 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ To build a 64bit Qemu image: freedombone-image -t qemu-x86_64 -s 8G -Other supported boards are cubieboard2, cubietruck, olinuxino-lime, olinuxino-lime2 and olinuxino-micro. +Other supported boards are cubieboard2, cubietruck, olinuxino-lime, olinuxino-lime2, olinuxino-micro and odroid-c2. If the image build fails with an error such as "/Error reading from server. Remote end closed connection/" then you can specify a debian package mirror repository manually with: diff --git a/man/freedombone-image.1.gz b/man/freedombone-image.1.gz index 497cc86f9736ef4d2fa00b0966c3fd0562576c82..0b97ff4d04713765baca84ba4bbd140761b6d98d 100644 GIT binary patch delta 3339 zcmV+m4fOJ{8n+rAABzY8KcaG100XsIZExJT5&o`ULF|{bfTc}*%^{HPDu85-VE^ zZCoRZLYuX)rm@29U871DHeY$Pfr6>%%>TUcjgsqkAR?knls z&el18i#2{v?Pr0L8l8#xjen4NUMuJP%i6Y$s>S{AT-X&1!$YGQ;a}5I<6emSx4L$X zIJ;U1oVUey^Be!}SllmEW=;O&WhUm|uV)8{?tIA?UZGTf)BY)N!cc3S2UEpmg z?n5+6UDt?!e{9Dm_yyJ!`|(ru$Vz5P-0uo$o=;Vid3$s&?%^u<`+*+p^h!7T3hTPx zC>lN{)uxtC{TkwXcD^{ho!>0y*H@EhxzSE!-+`H3ts4Ri;39F0thS3Yk;ytw!nX6P z#d7xk{mk!srYdD}Wq&e_eKTyCst$H47dzc-UPqC@KiB5iv1$;9M#TGWkw{xzUtPe(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(b!g&Ku21+?W_B=rS)%lKwGT+HVTi$fY%Tb5xM?C&cIge`TL@oy` zfAYGcxDn7a6$Lqy3gi&>a{xa~@Q#u>&Bss}iWW7D^x}bUPT$YZua*lj6?cmhadr!> zLynsHi)V$VF)pEfU+IkN0gE_#*#WOBn#i&7Ur2_ra&RRb03n?{B;w8#nwcbc)>mIv zb*0@Z=MQLVxuPywVwHjTmj^~|Bu&P-e~u3rr5vS+913M7y$*7A)sWA|1C=?A{OBTz zRSdolCWH-l++%gsfK%tOCiS89&Hu=(Z-IbFw+p{tjV_lwRZ<&3F7&1l1H*Dnl~D%` z#6wDQ8b@Fl4R{W;5CWmzhq0&`>+&!nr3*7Ay1s?NcZ4#ox|y#;i)OeWkie;+e@cKz z6#80|N=d}!DDIB8p=OF0)*X-)h)R_TST-4!XfR{Yq)1a0PU5!B-?fXEqGpGR2DKj~ zjt9?hZg+_5lK+VKSTjDkxK;hA^l7Agd_&Ld4z9;O33nv%8u)P#tw0W)s78v_4}o}| zlW(=7-qcrD;S&*>W@ki=4)t3Df0L((7@g)j5gt(w?S21ep> /etc/inittab + # By default, spawn a console on the serial port + device="$1" + echo $"Adding a getty on the serial port" + echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab } beaglebone_setup_boot() { - # Setup uEnv.txt - if grep -q btrfs /etc/fstab ; then - fstype=btrfs - else - fstype=ext4 - fi - kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4) - version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') - initRd=initrd.img-$version - vmlinuz=vmlinuz-$version + # Setup uEnv.txt + if grep -q btrfs /etc/fstab ; then + fstype=btrfs + else + fstype=ext4 + fi + kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4) + version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') + initRd=initrd.img-$version + vmlinuz=vmlinuz-$version - # uEnv.txt for Beaglebone - # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt - cat >> /boot/uEnv.txt <> /boot/uEnv.txt < /boot/$initRd ) + (cd /tmp/initrd-repack ; \ + zcat /boot/$initRd | cpio -i ; \ + rm -f conf/param.conf ; \ + find . | cpio --quiet -o -H newc | \ + gzip -9 > /boot/$initRd ) - rm -rf /tmp/initrd-repack + rm -rf /tmp/initrd-repack - (cd /boot ; \ - cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \ - cat $vmlinuz dtb >> temp-kernel ; \ - mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \ - -C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \ - rm -f temp-kernel ; \ - mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \ - -n "Debian ramdisk ${version}" \ - -d $initRd uInitrd ) + (cd /boot ; \ + cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \ + cat $vmlinuz dtb >> temp-kernel ; \ + mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \ + -C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \ + rm -f temp-kernel ; \ + mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \ + -n "Debian ramdisk ${version}" \ + -d $initRd uInitrd ) +} + +odroidc2_setup_boot() { + dtb="$1" + + # Setup uEnv.txt + if grep -q btrfs /etc/fstab ; then + fstype=btrfs + else + fstype=ext4 + fi + kernelVersion=$(ls /usr/lib/*/${dtb}.dtb | head -1 | cut -d/ -f4) + version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') + initRd=initrd.img-$version + vmlinuz=vmlinuz-$version + + # based on http://odroid.com/dokuwiki/doku.php?id=en:c2_building_u-boot + cat >> /boot/uEnv.txt <> /boot/boot.cmd <> /boot/boot.cmd <> /etc/initramfs-tools/modules + # extra boot modules + echo "rtc_sunxi" >> /etc/initramfs-tools/modules } case "$MACHINE" in - beaglebone) - beaglebone_setup_boot - beaglebone_flash - beaglebone_repack_kernel - enable_serial_console ttyO0 - ;; - cubietruck) - a20_setup_boot sun7i-a20-cubietruck.dtb - enable_serial_console ttyS0 - ;; - a20-olinuxino-lime) - a20_setup_boot sun7i-a20-olinuxino-lime.dtb - enable_serial_console ttyS0 - ;; - a20-olinuxino-lime2) - a20_setup_boot sun7i-a20-olinuxino-lime2.dtb - enable_serial_console ttyS0 - ;; - a20-olinuxino-micro) - a20_setup_boot sun7i-a20-olinuxino-micro.dtb - enable_serial_console ttyS0 - ;; - cubieboard2) - a20_setup_boot sun7i-a20-cubieboard2.dtb - enable_serial_console ttyS0 - ;; + beaglebone) + beaglebone_setup_boot + beaglebone_flash + beaglebone_repack_kernel + enable_serial_console ttyO0 + ;; + odroid-c2) + odroidc2_setup_boot meson64_odroidc2 + enable_serial_console ttyO0 + ;; + cubietruck) + a20_setup_boot sun7i-a20-cubietruck.dtb + enable_serial_console ttyS0 + ;; + a20-olinuxino-lime) + a20_setup_boot sun7i-a20-olinuxino-lime.dtb + enable_serial_console ttyS0 + ;; + a20-olinuxino-lime2) + a20_setup_boot sun7i-a20-olinuxino-lime2.dtb + enable_serial_console ttyS0 + ;; + a20-olinuxino-micro) + a20_setup_boot sun7i-a20-olinuxino-micro.dtb + enable_serial_console ttyS0 + ;; + cubieboard2) + a20_setup_boot sun7i-a20-cubieboard2.dtb + enable_serial_console ttyS0 + ;; esac diff --git a/src/freedombone-image-make b/src/freedombone-image-make index 25ab91aa..c614237a 100755 --- a/src/freedombone-image-make +++ b/src/freedombone-image-make @@ -83,6 +83,9 @@ logrotate module-init-tools netbase rsyslog udev debian-archive-keyring" # Packages needed on the beaglebone beaglebone_pkgs="linux-image-armmp u-boot-tools u-boot" +# Packages needed on the Odroid C2 devices: +odroidc2_pkgs="linux-image-armmp-lpae u-boot-tools u-boot" + # Packages needed on the Allwinner A20 devices: a20_pkgs="linux-image-armmp-lpae u-boot-tools u-boot u-boot-sunxi" @@ -103,6 +106,19 @@ case "$MACHINE" in --no-extlinux \ --foreign /usr/bin/qemu-arm-static \ --roottype btrfs \ +" + ;; + odroid-c2) + extra_pkgs="$odroidc2_pkgs" + extra_opts="\ + --variant minbase \ + --bootoffset=2mib \ + --bootsize 128M \ + --boottype ext2 \ + --no-kernel \ + --no-extlinux \ + --foreign /usr/bin/qemu-arm-static \ + --roottype btrfs \ " ;; cubietruck | a20-olinuxino-lime | a20-olinuxino-lime2 | a20-olinuxino-micro | cubieboard2) diff --git a/src/freedombone-image-makefile b/src/freedombone-image-makefile index 0d761027..c66839ab 100755 --- a/src/freedombone-image-makefile +++ b/src/freedombone-image-makefile @@ -89,6 +89,17 @@ beaglebone: prep $(SIGN) @echo "Build complete." +# build Odroid C2 SD card image +odroid-c2: prep + $(eval ARCHITECTURE = aarch64) + $(eval MACHINE = odroid-c2) + $(MAKE_IMAGE) + @rm -f $(ARCHIVE) + $(XZ) $(IMAGE) + @echo "" + $(SIGN) + @echo "Build complete." + # build Cubieboard2 SD card image cubieboard2: prep $(eval ARCHITECTURE = armhf)