-
Notifications
You must be signed in to change notification settings - Fork 2
NP1380 Emulation
NP1380-specific steps.
Download upgrade.bin from official website:
https://downloads.youxuepai.com/source/list.shtml#80&name=NP1380
See: qemu/create_nand_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 0x00201000 "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.qcow2Keypad is now supported.
The gpio-matrix-keypad device includes a very basic config parser for mapping keyboard input to matrix keypad.
Key names can be found in qemu/qapi/ui.json
Create a yaml mapping file named keymap_noah-np1380.yaml:
---
# For key names, check QKeyCode_lookup in qapi-types-ui.c
keymap:
row-0:
col-0: "right" # RIGHT
col-1: "left" # LEFT
col-2: "f2" # SOUND
col-3: "equal" # VOL+
row-1:
col-0: "up" # UP
col-1: "down" # DOWN
col-2: "f1" # MENU
col-3: "minus" # VOL-
row-2:
col-0: "ret" # ENTER
col-1: "esc" # ESCAPE
col-2: "pgdn" # PAGE DOWN
col-3: "pgup" # PAGE UP
pin-0: "f12" # Power button
pin-1: "f9" # Charging not done
pin-2: "f10" # Disconnect USB device port
pin-3: "f11" # Disconnect SD cardsystem_image=nand_overlay.qcow2
mmc_image=mmc_overlay.qcow2
./qemu-system-mipsel \
-M noah_np1380 -cpu JZ4740 \
-d guest_errors,unimp \
-bios jz4740.bin \
-parallel null \
-serial mon:stdio \
-global gpio-matrix-keypad.map-file=keymap_noah-np1380.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=0Force PD1 to 0 in qemu/hw/mips/noah_np1380.c to flash firmware.
See FIRMWARE_UPGRADE in that file.























