-
Notifications
You must be signed in to change notification settings - Fork 2
NP2150 Emulation
NP6800+-specific steps.
Download upgrade.bin from NP2150升级程序V1.4.55修复包.rar from official website:
https://downloads.youxuepai.com/source/tools/#83-NP2150-240
See: qemu/create_system_image.sh
#!/bin/bash -x
src=$1 #upgrade.bin
pkg=upgrade.pkg
nand=nand_image.bin
qcow2=nand_image.qcow2
# Extract data sections from upgrade.bin
[ -f $pkg ] || ./mkpkg --type=np1000 --extract $src $pkg
# Create NAND image
# Ignore errors as it does not support ubifs file system format yet
rm -f $nand
./create_nand_image.py -s $((2*1024*1024*1024)) -p 4096 -o 128 $pkg $nand
# (Optional) Write fake serial number
./write_serial.py -p 4096 -o 128 0x00301000 "QEMU $(date -Iseconds)" $nand
# (Optional) Convert NAND image to qcow2 format
qemu-img convert -f raw -O qcow2 $nand $qcow2Optionally create qcow2 overlay files, as snapshots, like this:
qemu-img create -f qcow2 -F qcow2 -b nand_image.qcow2 nand_overlay.qcow2The gpio-matrix-keypad device includes a very basic config parser for mapping keyboard input to device matrix keyboard.
Key names can be found in qemu/qapi/ui.json,
Or use --trace gpio_matrix_keypad_event QEMU trace log option to see key events.
Create a yaml mapping file named keymap.yaml:
---
keymap:
pin-0: "f12" # Power buttonSome dedicated pins are connected to special functions:
| Pin | Function |
|---|---|
| pin-0 | Power button |
Note: The NP2150 keyboard is not supported yet!
system_image=nand_overlay.qcow2
mmc_image=mmc_overlay.qcow2
./qemu-system-mipsel \
-M noah_np2150 \
-d guest_errors,unimp \
-bios jz4740.bin \
-parallel null \
-serial mon:stdio \
-global gpio-matrix-keypad.map-file=keymap.yaml \
-spice port=5910,disable-ticketing=on \
-display none \
-audio spice \
\
-blockdev driver=file,node-name=nand_qcow2,filename=$system_image \
-blockdev qcow2,node-name=nand,file=nand_qcow2 \
-global ingenic-emc-nand.drive=nand \
\
-blockdev driver=file,node-name=mmc_qcow2,filename=$mmc_image \
-blockdev qcow2,node-name=mmc,file=mmc_qcow2 \
-device sd-card,spec_version=3,drive=mmc \This starts a SPICE server at port 5910.
SPICE is used instead of VNC for remote audio support.
Here is an example spice.vv file for SPICE connection using virt-viewer (also available on Windows):
[virt-viewer]
type=spice
host=localhost
port=5910
delete-this-file=0
fullscreen=0Copy segment03.bin extracted from upgrade.bin to SD card image as uImage-upgrade.
During booting, on serial port console, repeatedly hit enter to interrupt u-boot autoboot and enter u-boot command line:
NAND Secondary Program Loader
Starting U-Boot ...
start_pbat_adc ***
======================= 2020
U-Boot 1.1.6 (Jun 30 2009 - 15:41:36)
Board: Ingenic PAVO (CPU Speed 336 MHz)
DRAM: 64 MB
Flash: 0 kB
NAND:2048 MiB
*** Warning - bad CRC or NAND, using default environment
LCD Select:IO_D0=1 IO_D1=1
LCD Type:LCD_NT39024C
The BPP is 32
PixClock:9333333 LcdClock:28000000
In: serial
Out: lcd
Err: lcd
Write I2C device 0x20 failed.
Write I2C device 0x20 failed.
Read I2C device 0x20 failed.
no menu keypad and right keypad is on!
Hit any key to stop autoboot: 0
NP2150#
NP2150#Then use the following commands to load and launch system upgrade kernel:
setenv bootargs mem=64M console=ttyS0,115200n8 ip=off root=/dev/ram0 rw rdinit=/sbin/init
mmcinit
fatload mmc 0 0x80600000 uImage-upgrade
bootmOr, as a one-liner:
setenv bootargs mem=64M console=ttyS0,115200n8 ip=off root=/dev/ram0 rw rdinit=/sbin/init; mmcinit; fatload mmc 0 0x80600000 uImage-upgrade; bootmTODO