<> == Hardware == Official product page: [[https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx53-quick-start-board:IMX53QSB|IMX53QSB: i.MX53 Quick Start Board]]. * CPU: MCIMX535DVV1B: armhf, with TrustZone, without LPAE (Large Physical Address Extensions), see [[DebianKernel/ARMMP]] and [[ArmHardFloatPort]] * RAM: 1GB DDR3 * Ethernet (J2B): SMSC LAN8720A Ethernet Transceiver, with auto‐negotiation * The SD Card Slot (J5) with support SDIO cards (WiFi, Bluetooth, etc) * SATA 7‐pin Data Connector (J7): it is not possible to boot from a SATA disk by default * Audio Input/Output (J6/J18): SGTL5000 * LVDS Connector (J9): 30‐pin (Hirose, DF19G‐30P‐1H(56)) * MMA8450QT Accelerometer * PMIC DA9053 or MC34708 — depending on board revision * 3.2V Secondary Voltage Regulator: Richtek, RT8010 * Optional Li‐ION Battery Connector (J14): 3‐Pin Header * Optional Back‐Up Coin Cell posts (JP1, JP2): 2‐Pin for RTC Operation: Sanyo ML1220‐VM1 or equivalent `/proc/cpuinfo`: {{{ processor : 0 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 66.66 Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc08 CPU revision : 5 Hardware : Freescale i.MX53 (Device Tree Support) Revision : 0000 Serial : 0000000000000000 }}} == Board revisions == Freescale kit name is "IMX53QSB" and another names are "IMX53Loco" and "MX53 LOCO". Actually there are two boards: === MCIMX53-START === This is an older version. PCB with yellow lines, PMIC Dialog DA9053. Has 6 revisions: A, B, C, D, E, F. The Device tree file is `imx53-qsb.dtb` === MCIMX53-START-R === The new one, with PMIC MC34708. Also you can see revision letter on Ethernet socket, it looks like "700-27104 REV C". The Device tree file is `imx53-qsrb.dtb` == Install Debian with debootstrap == To install, you need: * any Debian/Ubuntu computer with DebianPkg:debootstrap (or Gentoo with `dev-util/debootstrap` and `app-emulation/qemu` with USE-flag `static-user`) * SD card reader * microSD card, size at least 2GB * RS232 cable recommended, but not mandatory You have to install DebianPkg:qemu-user-static if your computer architecture is not armhf. {{{#!highlight shell sudo apt update sudo apt install qemu-user-static debootstrap }}} === Disk partitions === Use `gparted`, `cfdisk`, [[Parted]] of `fdisk` (see [[Partition]] for more info about utils). Create partitions on your microSD card: * use MBR, "MS-DOS Partition Table" (theoretically it is possible to use GPT, see [[https://www.barebox.org/doc/latest/boards/imx.html#using-gpt-on-i-mx|Using GPT on i.MX]]) * keep at least 1MB unused space at the beginning of microSD card (most modern partition editors do it automatically) * ext2 for boot, for example 200MB (u-boot can boot from ext4 too) * ext4 for root, for all available space * swap, if you wish ==== Check free space before partitions ==== You need at least 500 KB free space before first partition. It is better to check this before next steps: {{{ % sudo fdisk -l /dev/sdX Disk /dev/sdb: 7,52 GiB, 8064598016 bytes, 15751168 sectors Disk model: Card Reader Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x8a275704 Device Boot Start End Sectors Size Id Type /dev/sdb1 * 2048 2099199 2097152 1G 83 Linux /dev/sdb2 2099200 12584959 10485760 5G 83 Linux }}} Here, first partition starts on 2048*512 = 1048576, ~1MB, it is OK to write `u-boot` in this free space. Or, check first partition align by `parted`: {{{ % sudo parted /dev/sdb align-check optimal 1 1 aligned }}} Or, check `sudo sfdisk --list-free`. ==== Create filesystem and mount ==== In commands below, replace `/dev/sdX` with your path to SD-card device. Use `lsblk` to view full list. {{{#!highlight shell sudo mkfs.ext2 -L MX53_BOOT /dev/sdX1 sudo mkfs.ext4 -T small -L MX53_ROOT /dev/sdX2 sudo mkdir -pv /mnt/debinst sudo mount LABEL="MX53_ROOT" /mnt/debinst sudo mkdir -pv /mnt/debinst/boot sudo mount LABEL="MX53_BOOT" /mnt/debinst/boot }}} === Setup u-boot === Here is two option: install u-boot image precompiled by Debian or compile your own. ==== Precompiled by Debian ==== No support for GPT. In commands below, replace `/dev/sdX` with your path to SD-card device. Use `lsblk` to view full list. {{{#!highlight shell wget "http://ftp.us.debian.org/debian/dists/buster/main/installer-armhf/current/images/u-boot/MX53LOCO/u-boot.imx.gz" zcat u-boot.imx.gz > u-boot.imx sudo dd if=u-boot.imx of=/dev/sdX seek=2 bs=512 }}} (as an alternative. you can try fresh `u-boot` image from [[https://d-i.debian.org/daily-images/armhf/daily/u-boot/MX53LOCO/u-boot.imx.gz]]) Check partition table is not corrupted by `u-boot` image and wrong partition align: {{{ % sudo sfdisk --verify /dev/sdb /dev/sdb: Remaining 8409088 unallocated 512-byte sectors. }}} Here no errors found. Just for information, RS232 console output of `u-boot` from latest step (to see version and variables): {{{ U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000) CPU: Freescale i.MX53 rev2.1 at 800 MHz Reset cause: POR Board: MX53 LOCO I2C: ready DRAM: 1 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1 Loading Environment from MMC... *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: FEC Hit any key to stop autoboot: 0 => printenv baudrate=115200 boot_fdt=try bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi bootdelay=2 bootscript=echo Running bootscript from mmc ...; source ethact=FEC ethaddr=00:04:9f:02:3e:73 ethprime=FEC0 fdt_addr=0x71000000 fdt_file=imx53-qsrb.dtb image=zImage ip_dyn=yes loadaddr=0x72000000 loadbootscript=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script}; loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file} loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image} mmcargs=setenv bootargs console=ttymxc0,${baudrate} root=${mmcroot} mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi; mmcdev=0 mmcpart=1 mmcroot=/dev/mmcblk0p2 rw rootwait netargs=setenv bootargs console=ttymxc0,${baudrate} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo ERROR: Cannot load the DT; exit; fi; fi; else bootz; fi; script=boot.scr Environment size: 1518/8188 bytes }}} ==== Compile your u-boot image ==== {{{{#!wiki comment This chapter is not written. }}}} === Run debootstrap === {{{{#!wiki comment TODO: try wrapper `qemu-debootstrap`. }}}} See official Debian guide [[https://www.debian.org/releases/stable/armhf/apds03.en.html|Installing Debian GNU/Linux from a Unix/Linux System]] for more information. Run debootstrap (replace `ftp.us.debian.org` with your nearest Debian mirror): {{{#!highlight shell sudo debootstrap --arch armhf --foreign buster /mnt/debinst http://ftp.us.debian.org/debian }}} It will use about 190MB of space. === Run chroot === More information about chroot is in separate page: [[chroot]]. {{{#!highlight shell sudo cp -pv /usr/bin/qemu-arm-static /mnt/debinst/usr/bin/ sudo chroot /mnt/debinst qemu-arm-static /bin/bash env -i bash # Cleanup all environment variables export TERM=xterm-color export HOME=/root export LANG=C.UTF-8 }}} === Finish debootstrap === Commands for chroot (execution is slow, because of architecture emulation by `qemu`): {{{#!highlight shell /debootstrap/debootstrap --second-stage }}} === System setup === More details about steps below see in [[https://www.debian.org/releases/stable/armhf/apds03.en.html|Installing Debian GNU/Linux from a Unix/Linux System]]. Commands for chroot: {{{#!highlight shell apt install ncurses-term # to avoid `dpkg` warnings about Dialog update-alternatives --config editor editor /etc/fstab # /dev/mmcblk0p2 / auto errors=remount-ro 0 1 # /dev/mmcblk0p1 /boot auto ro,nosuid,nodev 0 2 editor /etc/adjtime dpkg-reconfigure tzdata editor /etc/network/interfaces editor /etc/resolv.conf echo imx53 > /etc/hostname apt install locales dpkg-reconfigure locales apt install console-setup dpkg-reconfigure keyboard-configuration apt search linux-image apt install linux-image-armmp u-boot-imx apt install init }}} === User account setup === Commands for chroot: {{{#!highlight shell apt install ssh passwd useradd -m -G users,audio,adm,sudo newuser passwd newuser }}} === Configure flash-kernel === Commands for chroot: {{{#!highlight shell apt install flash-kernel }}} flash-kernel uses `/proc/device-tree/model`, but it is wrong in chroot, so fill {{{#!highlight shell echo "Freescale i.MX53 Quick Start-R Board" > /etc/flash-kernel/machine # To substitute instead of `/proc/device-tree/model` which not accessible under chroot after debootstrap }}} Also, add manually to `/usr/share/flash-kernel/db/all.db`: {{{ Machine: Freescale i.MX53 Quick Start-R Board Machine: Freescale MX53 LOCO Board Kernel-Flavors: armmp mx5 DTB-Id: imx53-qsrb.dtb Boot-DTB-Path: /boot/board.dtb U-Boot-Kernel-Address: 0x70008000 U-Boot-Initrd-Address: 0x72000000 Boot-Kernel-Path: /boot/uImage Boot-Initrd-Path: /boot/uInitrd Required-Packages: u-boot-tools Bootloader-Sets-Incorrect-Root: no U-Boot-Script-Name: bootscr.mx5-my Boot-Script-Path: /boot/boot.scr }}} {{{#!highlight shell cp -pv /etc/flash-kernel/bootscript/bootscr.uboot-generic /etc/flash-kernel/bootscript/bootscr.mx5-my }}} Add to the beginning of `/etc/flash-kernel/bootscript/bootscr.mx5-my`: {{{ setenv distro_bootpart ${mmcpart} setenv boot_targets mmc setenv fdtfile ${fdt_file} setenv bootpart ${mmcpart} setenv devnum ${mmcdev} setenv console ttymxc0 setenv devtype mmc setenv fdt_addr_r ${fdt_addr} setenv ramdisk_addr_r ${loadaddr} setenv kernel_addr_r 0x70008000 setenv prefix / }}} Edit file `/etc/default/flash-kernel`: {{{ LINUX_KERNEL_CMDLINE="root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fixrtc" }}} Run flash-kernel: {{{#!highlight shell flash-kernel }}} Check files in `/boot/`: {{{ # ls -lAF /boot/ total 51020 -rw-r--r-- 1 root root 3138658 Apr 29 12:38 System.map-4.19.0-9-armmp -rw-r--r-- 1 root root 21932 Jun 6 21:14 board.dtb -rw-r--r-- 1 root root 3267 Jun 6 21:14 boot.scr -rw-r--r-- 1 root root 209315 Apr 29 12:38 config-4.19.0-9-armmp lrwxrwxrwx 1 root root 36 Jun 6 21:13 dtb -> dtbs/4.19.0-9-armmp/./imx53-qsrb.dtb lrwxrwxrwx 1 root root 36 Jun 6 21:13 dtb-4.19.0-9-armmp -> dtbs/4.19.0-9-armmp/./imx53-qsrb.dtb drwxr-xr-x 3 root root 4096 Jun 6 21:13 dtbs/ -rw-r--r-- 1 root root 20112393 Jun 6 19:07 initrd.img-4.19.0-9-armmp drwx------ 2 root root 16384 Jun 6 16:22 lost+found/ -rw-r--r-- 1 root root 4260416 Jun 6 21:14 uImage -rw-r--r-- 1 root root 20112457 Jun 6 21:14 uInitrd -rw-r--r-- 1 root root 4260352 Apr 29 12:38 vmlinuz-4.19.0-9-armmp }}} === Prepare to boot === Exit from chroot: {{{#!highlight shell service ssh stop exit }}} Umount partitions: {{{#!highlight shell sudo umount /mnt/debinst/boot /mnt/debinst sudo sync }}} === First boot === Insert microSD card and power on the board. RS232 output: {{{ U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000) CPU: Freescale i.MX53 rev2.1 at 800 MHz Reset cause: POR Board: MX53 LOCO I2C: ready DRAM: 1 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1 Loading Environment from MMC... *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: FEC Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device 3267 bytes read in 83 ms (38.1 KiB/s) Running bootscript from mmc ... ## Executing script at 72000000 4260352 bytes read in 390 ms (10.4 MiB/s) 21932 bytes read in 89 ms (240.2 KiB/s) 20111945 bytes read in 1583 ms (12.1 MiB/s) Booting Debian 4.19.0-9-armmp from mmc 0:1... Kernel image @ 0x70008000 [ 0x000000 - 0x410200 ] ## Flattened Device Tree blob at 71000000 Booting using the fdt blob at 0x71000000 Loading Ramdisk to 8e23a000, end 8f568249 ... OK Loading Device Tree to 8e231000, end 8e2395ab ... OK Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.19.0-9-armmp (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.118-2 (2020-04-29) [ 0.000000] CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: Freescale i.MX53 Quick Start-R Board [ 0.000000] Memory policy: Data cache writeback [ 0.000000] efi: Getting EFI parameters from FDT: [ 0.000000] efi: UEFI not found. [ 0.000000] cma: Reserved 16 MiB at 0xcf000000 [ 0.000000] CPU: All CPU(s) started in SVC mode. [ 0.000000] random: get_random_bytes called from start_kernel+0xa0/0x504 with crng_init=0 [ 0.000000] percpu: Embedded 17 pages/cpu s39756 r8192 d21684 u69632 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 260992 [ 0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fixrtc [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) [ 0.000000] Memory: 985968K/1048576K available (9216K kernel code, 1111K rwdata, 2588K rodata, 2048K init, 311K bss, 46224K reserved, 16384K cma-reserved, 507904K highmem) [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB) [ 0.000000] vmalloc : 0xe0800000 - 0xff800000 ( 496 MB) [ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB) [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB) [ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB) [ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (10208 kB) [ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (2048 kB) [ 0.000000] .data : 0x(ptrval) - 0x(ptrval) (1112 kB) [ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 312 kB) … Debian GNU/Linux 10 imx53 ttymxc0 imx53 login: }}} == Known issues, TODO == * VGA output is not working * cpufreq doesn't work * system shutdown doesn't poweroff the board Nice to have: * switch filesystem to readonly mode, to reduce SD card wear out == See also == * [[InstallingDebianOn/Freescale/i.MX53 Quick Start board]] — how to install Debian with `linaro-image-tools` * [[https://elinux.org/Freescale_IMX53QSB]] — use Linux kernel v2.6 and Barebox instead of `u-boot` * [[https://www.digikey.com/eewiki/display/linuxonarm/i.MX53+Quick+Start]] — how to compile `u-boot` (with [[https://github.com/eewiki/u-boot-patches/blob/master/v2019.04/0001-mx53loco-uEnv.txt-bootz-n-fixes.patch|patch]] for `CONFIG_EXTRA_ENV_SETTINGS`) and install image from rcn-ee.com == License == {{https://i.creativecommons.org/l/by/4.0/88x31.png}} This work is licensed under a [[http://creativecommons.org/licenses/by/4.0/|Creative Commons Attribution 4.0 International License]] or newer.