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:~# Install base system: blackbox:~# mount /dev/sde2 /mnt/tmp/ blackbox:~# qemu-debootstrap --foreign --include=ntp,ntpdate,less,u-boot,u-boot-tools,flash-kernel,linux-image-3.14-1-armmp,bash-completion,linux-firmware,fake-hwclock,emacs --exclude=nano --arch=armhf jessie /mnt/tmp http://http.debian.net/debian For kernel: https://packages.qa.debian.org/l/linux.html Copy appropriate dtb: blackbox:/mnt/tmp# cp /mnt/tmp/usr/lib/linux-image-3.14-1-armmp/imx6q-cubox-i.dtb /mnt/tmp/dtb Create boot.scr (check root partition): root@blackbox:/# cat /root/boot.cmd setenv device mmc setenv partition ${mmcdev}:${mmcpart} setenv bootargs 'root=/dev/mmcblk0p2 rootfstype=ext4 ro rootwait console=ttymxc0,115200 console=tty1' image_locations='/boot/ /' for pathprefix in ${image_locations} do load ${device} ${partition} ${loadaddr} ${pathprefix}vmlinuz \ && load ${device} ${partition} ${fdt_addr} ${pathprefix}dtb \ && load ${device} ${partition} ${ramdiskaddr} ${pathprefix}initrd.img \ && echo "Booting Debian ${kvers} from ${device} ${partition}..." \ && bootz ${loadaddr} ${ramdiskaddr}:${filesize} ${fdt_addr} done root@blackbox:/# 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:~# Flashing u-boot SPL and image: blackbox:/mnt/tmp# dd if=usr/lib/u-boot/mx6_cubox-i/SPL of=/dev/sde bs=1K seek=1 blackbox:/mnt/tmp# dd if=usr/lib/u-boot/mx6_cubox-i/u-boot.img of=/dev/sde 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"blackbox:~# Update apt configuration: blackbox:~# chroot /mnt/tmp/ root@blackbox:/# root@blackbox:/# cat /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 root@blackbox:/# cat /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 root@blackbox:/# RTC emulation (superseeded by fake-hwclock): -> avoids travel backward in time root@blackbox:~# cat /etc/init.d/rtcemu #!/bin/sh ### BEGIN INIT INFO # Provides: clockemu # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $portmap # Should-Stop: $portmap # X-Start-Before: syslog # X-Stop-After: syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # X-Interactive: true # Short-Description: emulates the RTC by setting the clock to the /var/log/syslog write time as early as possible # Description: This file should be used to construct scripts to be # placed in /etc/init.d. ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/init/vars.sh set -vx do_start() { date "+%D %T" -s "`date "+%D %T" -r /var/log/syslog`" } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac root@blackbox:~# root@blackbox:~# update-rc.d rtcemu defaults root@blackbox:~# ls -l /etc/rc2.d/ total 4 -rw-r--r-- 1 root root 677 Jun 7 23:32 README lrwxrwxrwx 1 root root 16 Jul 5 13:36 S01rtcemu -> ../init.d/rtcemu lrwxrwxrwx 1 root root 18 Jul 5 13:36 S02bootlogs -> ../init.d/bootlogs lrwxrwxrwx 1 root root 14 Jul 5 13:36 S02motd -> ../init.d/motd lrwxrwxrwx 1 root root 17 Jul 5 13:36 S02rsyslog -> ../init.d/rsyslog lrwxrwxrwx 1 root root 14 Jul 5 13:36 S03cron -> ../init.d/cron lrwxrwxrwx 1 root root 13 Jul 5 13:36 S03ntp -> ../init.d/ntp lrwxrwxrwx 1 root root 13 Jul 5 13:36 S03ssh -> ../init.d/ssh lrwxrwxrwx 1 root root 18 Jul 5 13:36 S04rc.local -> ../init.d/rc.local lrwxrwxrwx 1 root root 19 Jul 5 13:36 S04rmnologin -> ../init.d/rmnologin Create syslog to avoid initial 1970 time initialization and time jump root@blackbox:~# touch /var/log/syslog 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 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