Minicom: ======== Minicom is configured by default to use hardware flow control, so it was not sending any characters to the CuBox. ^A-O gets you to the Minicom configuration, select Serial port setup, and disable it. Debian: ======= Starting points: Debian Wiki: https://wiki.debian.org/ArmHardFloatPort/CuBox-i Install Tools on host: blackbox:~# apt-get install qemu-user-static debootstrap Partition mini-sdcard: ---------------------- Format device dmesg -> output -> blackbox:~# fdisk /dev/sde Command (m for help): p Disk /dev/sde: 31.7 GB, 31657558016 bytes 255 heads, 63 sectors/track, 3848 cylinders, total 61831168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sde1 8192 61831167 30911488 c W95 FAT32 (LBA) Command (m for help): Check for data points. blackbox:~# fdisk /dev/sde Command (m for help): p Disk /dev/sde: 31.7 GB, 31657558016 bytes 255 heads, 63 sectors/track, 3848 cylinders, total 61831168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sde1 8192 61831167 30911488 c W95 FAT32 (LBA) Command (m for help): d Selected partition 1 Command (m for help): p Disk /dev/sde: 31.7 GB, 31657558016 bytes 255 heads, 63 sectors/track, 3848 cylinders, total 61831168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 8192 Value out of range. Partition number (1-4, default 1): 1 First sector (2048-61831167, default 2048): 8192 Last sector, +sectors or +size{K,M,G} (8192-61831167, default 61831167): 8396799 Command (m for help): p Disk /dev/sde: 31.7 GB, 31657558016 bytes 255 heads, 63 sectors/track, 3848 cylinders, total 61831168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sde1 8192 8396799 4194304 83 Linux Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): 2 First sector (2048-61831167, default 2048): 8396800 Last sector, +sectors or +size{K,M,G} (8396800-61831167, default 61831167): Using default value 61831167 Command (m for help): p Disk /dev/sde: 31.7 GB, 31657558016 bytes 255 heads, 63 sectors/track, 3848 cylinders, total 61831168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sde1 8192 8396799 4194304 83 Linux /dev/sde2 8396800 61831167 26717184 83 Linux Command (m for help): t Partition number (1-4): 1 Hex code (type L to list codes): 82 Changed system type of partition 1 to 82 (Linux swap / Solaris) Command (m for help): p Disk /dev/sde: 31.7 GB, 31657558016 bytes 64 heads, 32 sectors/track, 30191 cylinders, total 61831168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sde1 8192 8396799 4194304 82 Linux swap / Solaris /dev/sde2 8396800 61831167 26717184 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. blackbox:~# Create file-system: blackbox:~# mkfs.ext4 /dev/sde2 mke2fs 1.42.10 (18-May-2014) Creating filesystem with 6679296 4k blocks and 1671168 inodes Filesystem UUID: 8d58946e-b213-4a98-a342-f03216490d28 Superblock-Sicherungskopien gespeichert in den Blöcken: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Platz für Gruppentabellen wird angefordert: erledigt Inode-Tabellen werden geschrieben: erledigt Erstelle Journal (32768 Blöcke): erledigt Schreibe Superblöcke und Dateisystem-Accountinginformationen: erledigt blackbox:~# mkswap /dev/sde1 Setting up swapspace version 1, size = 4194300 KiB no label, UUID=9908dd4e-c7e9-4bde-b858-268100b9fa5b blackbox:~# Install base system: blackbox:~# mount /dev/sde2 /mnt/tmp/ blackbox:~# qemu-debootstrap --exclude=nano --arch=armhf jessie /mnt/tmp http://http.debian.net/debian Update apt configuration: blackbox:~# cat /mnt/tmp/etc/apt/sources.list deb http://ftp-stud.fht-esslingen.de/debian/ jessie main contrib non-free deb-src http://ftp-stud.fht-esslingen.de/debian/ jessie main contrib non-free deb http://ftp-stud.fht-esslingen.de/debian/ sid main contrib non-free deb-src http://ftp-stud.fht-esslingen.de/debian/ sid main contrib non-free deb http://ftp-stud.fht-esslingen.de/debian/ experimental main contrib non-free deb-src http://ftp-stud.fht-esslingen.de/debian/ experimental main contrib non-free blackbox:~# cat /mnt/tmp/etc/apt/preferences.d/testing Package: * Pin: release o=Debian,a=testing Pin-Priority: 600 Package: * Pin: release o=Debian,a=unstable Pin-Priority: 300 Package: * Pin: release o=Debian,a=experimental Pin-Priority: 250 blackbox:~# blackbox:~# chroot /mnt/tmp apt-get update [...] blackbox:~# chroot /mnt/tmp apt-get install ntp less u-boot u-boot-tools linux-image-3.14-1-armmp bash-completion fake-hwclock emacs For kernel: https://packages.qa.debian.org/l/linux.html This error may be ignored: Processing triggers for initramfs-tools (0.115) ... update-initramfs: Generating /boot/initrd.img-3.14-1-armmp /bin/df: Warning: cannot read table of mounted file systems: No such file or directory warning: failed to read mtab /bin/grep: /proc/cpuinfo: No such file or directory Warning: root device does not exist /bin/grep: /proc/cpuinfo: No such file or directory Unsupported platform. run-parts: /etc/initramfs/post-update.d//flash-kernel exited with return code 1 dpkg: error processing package initramfs-tools (--configure): subprocess installed post-installation script returned error exit status 1 Processing triggers for libgdk-pixbuf2.0-0:armhf (2.30.7-1) ... Processing triggers for sgml-base (1.26+nmu4) ... Errors were encountered while processing: initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1) blackbox:~# Prepare boot settings: blackbox:~# chroot /mnt/tmp/ root@blackbox:/# export FK_MACHINE="SolidRun Cubox-i Dual/Quad" # flash-kernel needs to be >= 3.22 root@blackbox:/# apt-get install -t sid flash-kernel root@blackbox:/# exit blackbox:~# cd /mnt/tmp/ Flashing u-boot SPL and image: blackbox:~# dd if=/mnt/tmp/usr/lib/u-boot/mx6_cubox-i/u-boot-spl.bin of=/dev/sdX bs=1K seek=1 blackbox:~# dd if=/mnt/tmp/usr/lib/u-boot/mx6_cubox-i/u-boot.img of=/dev/sdX bs=1K seek=42 blackbox:/mnt/tmp# Config updates blackbox:~# chroot /mnt/tmp passwd root blackbox:~# echo 'T0:23:respawn:/sbin/getty -L ttymxc0 115200 vt100' >> /mnt/tmp/etc/inittab Modify to blackbox:~# cat /mnt/tmp/etc/default/flash-kernel #LINUX_KERNEL_CMDLINE="quiet" LINUX_KERNEL_CMDLINE="root=/dev/mmcblk0p2 rootfstype=ext4 ro rootwait console=ttymxc0,115200 console=tty1 elevator=noop" blackbox:~# blackbox:/mnt/tmp# chroot /mnt/tmp/ root@blackbox:/# export FK_MACHINE="SolidRun Cubox-i Dual/Quad" root@blackbox:/# flash-kernel Boot into u-boot: CuBox-i U-Boot > printenv autoboot=echo Booting ${boot_file}; if test ${boot_file} = zImage; then bootz ${loadaddr} ${ramdiskaddr}; else bootm ${loadaddr} ${ramdiskaddr}; fi; autobootfdt=echo Booting ${boot_file}; if test ${boot_file} = zImage; then bootz ${loadaddr} ${ramdiskaddr} ${fdt_addr}; else bootm ${loadaddr} ${ramdiskadd; autodetectfdt=if test ${cpu} = 6SOLO || test ${cpu} = 6DL; then setenv fdt_prefix imx6dl; else setenv fdt_prefix imx6q; fi; if test ${board} = mx6-cubox-i; ; baudrate=115200 board=mx6-cubox-i boot_fdt=try boot_prefixes=/ /boot/ bootcmd=mmc dev ${mmcdev}; if mmc rescan; then for prefix in ${boot_prefixes}; do setenv file_prefix ${prefix}; if run loadbootscript; then run bootscript; ; bootdelay=3 bootenv=uEnv.txt bootfile=auto bootit=setenv boot_file ${bootfile}; if test ${boot_file} = zImage; then if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then run ; bootscript=echo Running bootscript from mmc ...; source; console=ttymxc0 cpu=6Q ethact=FEC ethaddr=d0:63:b4:00:32:5c ethprime=FEC fdt_addr=0x18000000 fdt_high=0xffffffff importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}; initrd_high=0xffffffff ip_dyn=yes loadaddr=0x10800000 loadbootenv=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootenv}; loadbootfile=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${file_prefix}${bootfile}; loadbootscript=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${file_prefix}${script}; loadfdt=if test ${boottype} = mmc; then load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${file_prefix}${fdt_file}; else ${get_cmd} ${fdt_addr} ${fdt_file}; fi; loadramdisk=if test -n ${ramdisk}; then if load mmc ${mmcdev}:${mmcpart} ${ramdiskaddr} ${file_prefix}${ramdisk}; then; else setenv ramdiskaddr -; fi; else ; mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}; mmcboot=echo Booting from mmc ...; run mmcargs; setenv boottype mmc; run bootit; mmcdev=0 mmcpart=1 mmcroot=/dev/mmcblk0p2 rootwait rw netargs=setenv bootargs console=${console},${baudrate} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp; netboot=echo Booting from net ...; run netargs; setenv boottype net; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if tes; preboot=usb start ramdisk=uInitrd ramdiskaddr=0x11800000 script=boot.scr splashpos=m,m stderr=serial,vga stdin=serial,usbkbd stdout=serial,vga update_sd_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if mmc dev ${mmcdev}; then if ${get_cmd} ${update_sd_fir; update_sd_firmware_filename=u-boot.imx Environment size: 3809/8188 bytes CuBox-i U-Boot > setenv mmcpart 2 CuBox-i U-Boot > boot mmc0 is current device ** File not found /boot.scr ** ** File not found uEnv.txt ** ** File not found /zImage ** ** File not found /uImage ** 1578 bytes read in 96 ms (15.6 KiB/s) Running bootscript from mmc ... ## Executing script at 10800000 Login as root: # flash-kernel # apt-get install -f # apt-get install dpkg --reinstall (to fix Warning: Fake start-stop-daemon called, doing nothing messages when starting openssh-server) Set time zone: root@home:~# dpkg-reconfigure tzdata hostname and FQDN: root@blackbox:~# echo home > /etc/hostname root@home:~# cat /etc/hosts 127.0.0.1 home.bokomoko.de localhost home ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters Background information: ======================= u-boot: ------- u-boot is the bootloader for cubox-i -> The cubox-i has the initial program loader (IPL) in its NVM. Debian provides the secondary boot loader (SPL) and an image file with predefined u-boot variables. -> The SPL provides an u-boot command interpreter. -> There are a number of predefined variables: - In the u-boot environment 'run bootcmd' is executed automatically if the u-boot is not interrupted. - The default bootcmd (for cubox-i) first tries loading boot.scr, uEnv.txt, zImage, uImage from /, and then falls back to /boot/boot.scr, /boot/uEnv.txt, etc. if it doesn't find any. The default location for flash-kernel is /boot/boot.scr. - The /boot/boot.scr may be decoded using dd if=/boot/boot.scr bs=64 skip=1 of=/tmp/boot.cmd - Create an updated boot.scr or alternate boot.scr: root@blackbox:~# mkimage -A arm -O linux -T script -C none -n "Initial u-boot script" -d /mnt/tmp/root/boot.cmd /mnt/tmp/boot/boot.scr Image Name: U-Boot commands Created: Sat Jul 5 13:26:17 2014 Image Type: ARM Linux Script (uncompressed) Data Size: 1518 Bytes = 1.48 kB = 0.00 MB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 1510 Bytes = 1.47 kB = 0.00 MB root@blackbox:~# flash-kernel: ------------- flash-kernel automates the cubox-i specific adaptions for a new kernel. These are - Creating /boot/boot.scr - Copying the correct dtb file to the / directory This is basically done by using the device tree model string from /proc/device-tree/model and selecting the corresponding entry in /usr/share/flash-kernel/db/all.db Machine: SolidRun Cubox-i Dual/Quad Kernel-Flavors: armmp DTB-Id: imx6q-cubox-i.dtb Boot-Script-Path: /boot/boot.scr U-Boot-Script-Name: bootscr.cubox-i Required-Packages: u-boot-tools Device tree files: ------------------ http://d-i.debian.org/daily-images/armhf/daily/device-tree/ Comments from Vagrant: ====================== A few comments: chroot /mnt/tmp apt-get install ntp,ntpdate,less... These two things might help avoid later having to run "apt-get -f install" and "apt-get install dpkg --reinstall", which seem like they should be unnecessary. If you pull flash-kernel from sid instead of jessie, you shouldn't have to manually create the boot.scr file, but you may have to manually specify which machine to emulate (see FK_MACHINE and /etc/flash-kernel/machine in the flash-kernel manpage). It *should* be safe to force the machine type on Cubox-i, as all it does is create the boot.scr and copy the dtb, but other platforms could do destructive things.