Jump to content

Next Thing Co. CHIP (ntc-chip)

From Nura Wiki
Next Thing Co. CHIP
Next Thing Co. CHIP
Next Thing Co. CHIP
Manufacturer Next Thing Co.
Name CHIP
Codename ntc-chip
Released 2015
Hardware
Chipset Allwinner R8
CPU 1x 1.0 GHz Cortex-A8
GPU Mali-400 MP1
Display Composite video
Storage 8GB MLC NAND
Memory 512 MB DDR3
Architecture armv7
Software
Original software
The software and version the device was shipped with.
Debian ? (Linux 4.4)
Extended version
The most recent supported version from the manufacturer.
Debian
Nura
Category testing
Mainline
Instead of a Linux kernel fork, it is possible to run (Close to) Mainline.
yes
Nura kernel
The kernel version that runs on the device's port.
6.19.8
Features
Flashing
Whether it is possible to flash the device with pmbootstrap flasher.
Broken
USB Networking
After connecting the device with USB to your PC, you can connect to it via telnet (initramfs) or SSH (booted system).
Works
Battery
Whether charging and battery level reporting work.
Untested
Screen
Whether the display works; ideally with sleep mode and brightness control.
Untested
Multimedia
3D Acceleration
Untested
Audio
Audio playback, microphone, headset and buttons.
Untested
Connectivity
Wi-Fi
Partial
Bluetooth
Untested
Miscellaneous
FDE
Full disk encryption and unlocking with unl0kr.
Untested

Contributors

  • Symmetrist
  • yeyeto2788

Maintainer(s)

  • yeyeto2788

Status

Nura boots from the internal NAND on a mainline kernel (6.19.8) with mainline U-Boot. No vendor blobs are involved in the boot chain.

Working: NAND cold boot, serial console on UART1, USB gadget networking and SSH, UBI/UBIFS rootfs with autoresize, nftables, zram swap. The RTL8723BS WiFi driver and firmware load and scanning works; association has not been verified yet. Composite video output, audio, bluetooth and the battery/charging path are untested.

The earlier port attempt (pmaports!1098, 2020) got the kernel booting but stalled on the bootloader — "u-boot needs to be packaged". That is now done: a u-boot-ntc-chip package builds mainline U-Boot 2024.04 with the sun5i workarounds and NAND support this board needs.

Hardware variants: check your NAND first

This port has only been validated on the 8 GiB Hynix H27UCG8T2ETR-BC (MLC) NAND, chip ID ad de 14 a7 42 4a, with 16384-byte pages and a 4 MiB eraseblock. CHIP boards shipped with more than one NAND part, and the geometry below (LEB size, PEB size, ECC settings) is specific to that chip. If your board has a different NAND, the UBI parameters in this page will not match it and the resulting image will not boot.

The older revision of this page documented a 2 MiB eraseblock, which suggests other variants exist in the wild. Check the eraseblock your board reports before following the flashing steps.

How to enter flash mode

The board is flashed over FEL mode (Allwinner's USB recovery mode):

  • Connect the FEL and GND pins with a jumper cable
  • Power on the CHIP
  • Verify on the host: lsusb | grep 1f3a:efe8

Keep the jumper bridged for the entire flashing procedure — the board must re-enter FEL between chunks (see below).

Fastboot is not used by this port. The fastboot instructions in the older revision of this page applied to the original Next Thing Co. U-Boot.

Install Nura

1. Build the rootfs

$ pmbootstrap init      # device: ntc-chip, UI: console
$ pmbootstrap install --no-image

--no-image is important: the rootfs is packed into a UBI image by hand below, not into a regular disk image.

Keep the rootfs small enough to leave headroom on the 8 GiB NAND — excluding /var/cache/* (the apk cache) and /boot/initramfs from the image is recommended.

2. Build the UBI image

Stock mkfs.ubifs and ubinize refuse LEBs larger than 2 MiB, which makes them unable to produce an image for this NAND at all. The mtd-utils-chip package raises that cap to 8 MiB and installs its binaries with a -chip suffix.

$ pmbootstrap chroot --add mtd-utils-chip -- mkfs.ubifs-chip \
    --min-io-size=16384 \
    --leb-size=4161536 \
    --max-leb-cnt=4096 \
    --compr=lzo \
    --root=<rootfs> \
    --output=rootfs.ubifs

The compression must be lzo. U-Boot's UBIFS driver only understands lzo and zlib; a zstd superblock makes U-Boot reject the filesystem (errno=-22) and it cannot then load the kernel from it.

Then wrap the UBIFS volume in a UBI image, using a single autoresizing rootfs volume so it expands to the whole partition on first attach:

[rootfs]
mode=ubi
image=rootfs.ubifs
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
$ pmbootstrap chroot --add mtd-utils-chip -- ubinize-chip \
    --output=pmos-chip-nand.ubi \
    --min-io-size=16384 \
    --peb-size=4194304 \
    --sub-page-size=16384 \
    ubinize.cfg

3. NAND layout

Offset Contents
0x0 SPL (boot0 format)
0x400000 SPL backup copy
0x800000 U-Boot proper
0x1000000 UBI (rootfs)

The SPL must be written in boot0 format (sunxi-spl-with-ecc.bin, as built by u-boot-ntc-chip) using nand write.raw.noverify. This is what the BROM can read, and it is not optional for cold boot from NAND.

4. Flash over FEL

The image is written by U-Boot itself, which is loaded into RAM over FEL. The UBI image is uploaded to RAM in chunks of 128 MiB and flushed to NAND one chunk at a time, because U-Boot reserves the top of DRAM for itself: a staging buffer at 0x50000000 must not grow past roughly 0x5AE00000 or U-Boot will overwrite the tail of the image before it is written, silently corrupting files.

For each chunk, in one FEL session:

$ sunxi-fel spl sunxi-spl.bin              # DRAM init, board re-enters FEL
$ sunxi-fel write 0x4a000000 u-boot-padded.bin
$ sunxi-fel write 0x50000000 ubi-chunk-NN  # the chunk itself
$ sunxi-fel write 0x43100000 flash-NN.scr  # U-Boot script, see below
$ sunxi-fel exe  0x40000000                # trampoline into U-Boot

U-Boot must be re-uploaded in every session. The board resets between chunks and DRAM contents decay; jumping into a stale copy hangs or writes corrupted data.

The U-Boot script for the first chunk erases the chip and writes the bootloader:

nand erase.chip
nand write.raw.noverify 0x43000000 0x0      <pages>
nand write.raw.noverify 0x43000000 0x400000 <pages>
nand write 0x4a000000 0x800000 <uboot-size>
nand write.trimffs 0x50000000 0x1000000 <chunk-size>

Every later chunk must erase its own region first — NAND pages cannot be rewritten without an erase:

nand erase <offset> <chunk-size>
nand write.trimffs 0x50000000 <offset> <chunk-size>

Between chunks the board has to get back into FEL. This U-Boot has no sysreset driver (reset reports "not supported"), so poke the sun5i watchdog directly — with the FEL jumper still on, the board comes back up in FEL by itself:

mw.l 0x01c20c94 0x3       # WDOG_MODE: enable + reset, shortest interval
mw.l 0x01c20c90 0x14af    # WDOG_CTRL reload kick (arming MODE alone is flaky)

If the watchdog does not fire, power cycle the board manually with the jumper still bridged.

After the last chunk, boot it:

setenv fdtfile sun5i-r8-chip.dtb
boot
Note Never resume a partial flash after the board has booted the image. A

read-write UBIFS mount rewrites UBI state on NAND, so restoring only some chunks afterwards leaves unmapped LEBs and produces -EIO on random

files. After any boot, redo a full flash from the first chunk.

5. After flashing

Remove the FEL jumper, or the next cold boot lands in FEL again.

  • Serial console: UART1, 115200 8N1
  • USB gadget network: the board is 10.42.0.2/24. On the host:
$ nmcli con add type ethernet ifname usb0 con-name chip-usb \
    ipv4.method manual ipv4.addresses 10.42.0.1/24
$ ssh <user>@10.42.0.2

Known issues

  • pmbootstrap flasher does not support this device; flashing is the
 manual FEL procedure above (deviceinfo_flash_method="none").
  • The kernel and U-Boot packages carry a set of sun5i AHB/MBUS "settle"
 workarounds. Without them the board hangs at reproducible points during boot.
 These are empirical workarounds, not a root cause, and have not been reduced
 to a minimal set.
  • WiFi association has not been verified (scanning works).
  • Composite video output, audio, bluetooth and battery charging are untested.

See also