├── LICENSE ├── Makefile ├── README.md ├── boot_scr ├── orangepi_one_boot.scr ├── orangepi_pc_boot.scr ├── orangepi_pc_plus_boot.scr └── orangepi_plus2e_boot.scr ├── build.sh ├── copy-rootfs.sh ├── getkern.sh ├── getuboot.sh ├── mkimage.sh ├── mkrootfs.sh ├── partition.sh ├── script_bin ├── orangepi_one_script.bin ├── orangepi_pc_plus_script.bin ├── orangepi_pc_script.bin ├── orangepi_plus2e_script.bin └── readme ├── test ├── test.c └── utils ├── chrootscript-jessie └── install2emmc.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Olgierd Nowakowski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | clean: 2 | rm -rf md-debian sun8i rootfs *.img Sambooca-Kernel-H3 u-boot u-boot-sunxi-with-spl.bin 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # md-debian 2 | Debian build system for Orange Pi and other Allwinner H3 boards (will support more in the future if I get my hands on them. donations/testers/contributors welcome.) 3 | 4 | ## BASIC USAGE 5 | You need sudo installed and set up. 6 | 7 | Adjust build.sh defines to your system, then just run build.sh as root 8 | 9 | 10 | ## FUTURE: 11 | I am planning to set up a repo for shipping kernel updates and custom applications (not anything major, just chip-specific stuff, like for changing resolution, etc.) 12 | 13 | The build script is tested on Debian Stretch, and its the only supported platform for now, but it should work on anything with minor modifications (replace "CROSS_COMPILE" and "CC" with any triplet your system uses.) 14 | 15 | 16 | ## LICENSE: 17 | Its provided AS-IS, without warranty of any kind. 18 | I am not responsible for burned boards, accidentally formated drives, broken SD cards or nuclear war. 19 | None of these things should happen if used properly. 20 | 21 | I, and this project is not affiliated,sponsored or endorsed by Debian 22 | -------------------------------------------------------------------------------- /boot_scr/orangepi_one_boot.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moondeck/md-debian/f011bc9dee1f530e191ab46b439bc68b564b6a8d/boot_scr/orangepi_one_boot.scr -------------------------------------------------------------------------------- /boot_scr/orangepi_pc_boot.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moondeck/md-debian/f011bc9dee1f530e191ab46b439bc68b564b6a8d/boot_scr/orangepi_pc_boot.scr -------------------------------------------------------------------------------- /boot_scr/orangepi_pc_plus_boot.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moondeck/md-debian/f011bc9dee1f530e191ab46b439bc68b564b6a8d/boot_scr/orangepi_pc_plus_boot.scr -------------------------------------------------------------------------------- /boot_scr/orangepi_plus2e_boot.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moondeck/md-debian/f011bc9dee1f530e191ab46b439bc68b564b6a8d/boot_scr/orangepi_plus2e_boot.scr -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # BUILD CONFIGURATION HERE, CHANGE IF NEEDED!!! 4 | 5 | CROSS_COMPILE=arm-linux-gnueabihf- 6 | CC=arm-linux-gnueabihf-gcc 7 | SYS_VERSION= 8 | ARCH=armhf 9 | CARDSIZE=1024 # size of the image, can be down to about 700mb for a usable minimal nogui image. 10 | 11 | # END OF BUILD CONFIG 12 | 13 | 14 | whoami > .tmp_who 15 | if [[ ! ($(cat .tmp_who) == "root") ]]; then 16 | echo "you are not root!" 17 | exit 18 | fi 19 | 20 | if [[ $1 == "--help" || $1 == "-h" || $# < 5 ]]; then 21 | echo "Usage: build.sh system board board_series wm img_version" 22 | echo "See moondeck.github.io/md-debian for an up-to-date list of options" 23 | exit 24 | fi 25 | 26 | if [[ ! ($? == 0)]]; then 27 | echo "moonbian build script exiting..." 28 | rm -rf md-debian sun8i rootfs distimage.img Sambooca-Kernel-H3 u-boot u-boot-sunxi-with-spl.bin 29 | rm .tmp* 30 | exit 31 | fi 32 | 33 | VERSION=$5 34 | TARGET_BOARD=$2 35 | BOARD_SERIES=$3 36 | SYS_VERSION=$1 37 | WINDOW_MANAGER=$4 38 | 39 | clear 40 | 41 | rm -rf md-debian sun8i rootfs *.img Sambooca-Kernel-H3 u-boot u-boot-sunxi-with-spl.bin *.tar.gz 42 | 43 | wget http://repo.novakovsky.eu/moonbian/$SYS_VERSION/rootfs.tar.gz 44 | 45 | tar -xf rootfs.tar.gz 46 | rm -rf *.tar.gz 47 | 48 | cp /etc/resolv.conf rootfs/etc 49 | cp utils/chrootscript-$SYS_VERSION rootfs/bin/ 50 | chmod 774 rootfs/bin/chrootscript-$SYS_VERSION 51 | chroot rootfs /bin/bash -c "chrootscript-$SYS_VERSION $WINDOW_MANAGER && exit" 52 | rm rootfs/bin/chrootscript-$SYS_VERSION 53 | 54 | ./getuboot.sh $TARGET_BOARD $CROSS_COMPILE $CC 55 | 56 | ./getkern.sh $CC $CROSS_COMPILE $BOARD_SERIES 57 | 58 | dd if=/dev/zero of=$TARGET_BOARD-$VERSION-$WINDOW_MANAGER-image.img bs=1M count=$CARDSIZE 59 | sync 60 | 61 | ./partition.sh $TARGET_BOARD $VERSION $WINDOW_MANAGER 62 | ./copy-rootfs.sh rootfs $TARGET_BOARD $VERSION $WINDOW_MANAGER 63 | 64 | 65 | rm .tmp* 66 | echo "moondeck's debian build system done. thanks." 67 | -------------------------------------------------------------------------------- /copy-rootfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sync 4 | losetup /dev/loop0 $2-$3-$4-image.img 5 | partprobe /dev/loop0 6 | mkfs.ext2 /dev/loop0p1 7 | mount /dev/loop0p1 /mnt 8 | cp utils/* rootfs/usr/sbin 9 | chmod -R 744 rootfs/usr/sbin 10 | 11 | chown -R man /var/cache/man 12 | 13 | cp Sambooca-Kernel-H3/arch/arm/boot/zImage rootfs/boot/ 14 | cp script_bin/$2_script.bin rootfs/boot/script.bin 15 | cp boot_scr/$2_boot.scr rootfs/boot/boot.scr 16 | 17 | mkdir rootfs/md-debian 18 | cp u-boot-sunxi-with-spl.bin rootfs/md-debian 19 | 20 | if [[ $2 = "orangepi_pc_plus" || $2 = "orangepi_plus2e" ]]; then 21 | cp utils/install2emmc.sh rootfs/usr/bin 22 | fi 23 | 24 | cp -r rootfs/* /mnt 25 | sync 26 | umount /mnt 27 | dd if=u-boot-sunxi-with-spl.bin of=/dev/loop0 bs=1024 seek=8 conv=notrunc 28 | losetup -d /dev/loop0 29 | -------------------------------------------------------------------------------- /getkern.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $3 == "orangepi" ]]; then 4 | git clone https://github.com/SvenKayser/Sambooca-Kernel-H3.git --branch sun8i --depth 1 5 | cd Sambooca-Kernel-H3 6 | make -j`nproc` ARCH=arm CC=$1 CROSS_COMPILE=$2 7 | make ARCH=arm CC=$1 CROSS_COMPILE=$2 INSTALL_MOD_PATH=../rootfs modules_install 8 | cd .. 9 | echo "Grabbed and compiled the kernel!" 10 | else 11 | git clone https://github.com/moondeck/md-linux --depth 1 12 | cd md-linux 13 | make ARCH=arm CC=$1 CROSS_COMPILE=$2 medionbox_defconfig 14 | make -j`nproc` ARCH=arm CC=$1 CROSS_COMPILE=$2 15 | make ARCH=arm CC=$1 CROSS_COMPILE=$2 INSTALL_MOD_PATH=../rootfs modules_install 16 | cd .. 17 | echo "Grabbed and compiled the kernel!" 18 | fi 19 | -------------------------------------------------------------------------------- /getuboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git clone git://git.denx.de/u-boot.git --depth 1 4 | cd u-boot 5 | make CROSS_COMPILE=$2 CC=$3 $1_defconfig 6 | make CROSS_COMPILE=$2 CC=$3 7 | cp u-boot-sunxi-with-spl.bin .. 8 | cd .. 9 | -------------------------------------------------------------------------------- /mkimage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CARDSIZE=2048 # size of the image, can be down to about 700mb for a usable minimal nogui image. 4 | TARGET_BOARD=$1 5 | WINDOW_MANAGER=$3 # must be "nogui" if no WM 6 | VERSION=$2 7 | 8 | dd if=/dev/zero of=$TARGET_BOARD-$VERSION-$WINDOW_MANAGER-image.img bs=1M count=$CARDSIZE 9 | sync 10 | 11 | ./partition.sh $TARGET_BOARD $VERSION $WINDOW_MANAGER 12 | ./copy-rootfs.sh rootfs $TARGET_BOARD $VERSION $WINDOW_MANAGER 13 | -------------------------------------------------------------------------------- /mkrootfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | debootstrap --arch=$(ARCH) --foreign $(SYS_VERSION) $(TARGET_ROOTFS) 4 | -------------------------------------------------------------------------------- /partition.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #wow this is such a hack 4 | 5 | sudo fdisk $1-$2-$3-image.img < 2 | 3 | int main() { 4 | printf("if the compiler works, i will compile!\n"); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /utils/chrootscript-jessie: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | 5 | ROOTFS_HOSTNAME="opi-debian" 6 | 7 | ROOTFS_USER_PASS="orangepi" 8 | ROOTFS_ROOT_PASSWORD="root" 9 | 10 | 11 | ROOTFS_USERNAME="orangepi" 12 | echo " 13 | 14 | mmmmmmmm oooooooooo oooooooooo nn nnnnnn bb ii aaaaaaa nn nnnnnn 15 | mm mm mm oo oo oo oo nnn nn bb ii aa aa nnn nn 16 | mm mm mm oo oo oo oo nn nn bbbbbbbbb ii aa aa nn nn 17 | mm mm mm oo oo oo oo nn nn bb bb ii aa aa nn nn 18 | mm mm mm oooooooooo oooooooooo nn nn bbbbbbbbb ii aaaaaa a nn nn 19 | 20 | 21 | " 22 | 23 | dpkg --configure -a 24 | hostname $ROOTFS_HOSTNAME 25 | 26 | echo "root password is $ROOTFS_ROOT_PASSWORD" 27 | 28 | echo root:$ROOTFS_ROOT_PASSWORD | chpasswd 29 | 30 | 31 | echo " 32 | 33 | Creating an user with the name $ROOTFS_USERNAME 34 | User password is $ROOTFS_USER_PASS 35 | 36 | " 37 | useradd -p $ROOTFS_USER_PASS $ROOTFS_USERNAME 38 | 39 | echo " 40 | deb http://deb.debian.org/debian jessie main 41 | deb http://http.debian.net/debian jessie-backports main 42 | 43 | deb http://repo.novakovsky.eu/moonbian moonbian/ 44 | " > /etc/apt/sources.list 45 | 46 | apt-get update 47 | 48 | if [[ $1 = "xfce" ]]; then 49 | apt-get -yy install xfce4 xdm xfce4-goodies network-manager-gnome 50 | fi 51 | 52 | if [[ $1 = "gnome" ]]; then 53 | apt-get -yy install gnome network-manager-gnome 54 | fi 55 | 56 | apt-get -yy install locales debconf wpasupplicant iw ssh network-manager ntp sunxi-tools 57 | dpkg-reconfigure locales 58 | 59 | echo " 60 | hdmi 61 | gpio-sunxi 62 | " > /etc/modules 63 | -------------------------------------------------------------------------------- /utils/install2emmc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dd if=/dev/zero of=/dev/mmcblk1 bs=8M count=1 4 | 5 | fdisk /dev/mmcblk1 <