Skip to content

Instantly share code, notes, and snippets.

@ganboing
ganboing / uEnv.txt
Last active June 30, 2025 02:26
JH7100 uEnv.txt
# Set initrd_high and fdt_high to -1
# This disables the relocation of them by u-boot in bootx commands
initrd_high=0xffffffffffffffff
fdt_high=0xffffffffffffffff
scriptaddr=0xa0000000
# Disable autoload. Useful for dhcp/tftpboot to download without boot
#autoload=0
# Optimization: Load kernel to DRAM + 2MB
@ganboing
ganboing / README.md
Last active June 29, 2025 00:04
Linux 6.12 config for JH7100

Difference between Debian Trixie 6.12 kernel config and config for jh7100:

Noteable changes are:

  • Disable ARCH_SUNXI and ARCH_THEAD
  • Enable NONPORTABLE
  • Enable ERRATA_STARFIVE_JH7100
  • Enable BRCMFMAC_SDIO
@ganboing
ganboing / p550-perf-list.txt
Created June 23, 2025 22:50
P550 perf events
branch-instructions OR branches [Hardware event]
branch-misses [Hardware event]
bus-cycles [Hardware event]
cache-misses [Hardware event]
cache-references [Hardware event]
cpu-cycles OR cycles [Hardware event]
instructions [Hardware event]
ref-cycles [Hardware event]
stalled-cycles-backend OR idle-cycles-backend [Hardware event]
stalled-cycles-frontend OR idle-cycles-frontend [Hardware event]
@ganboing
ganboing / README
Last active May 5, 2025 09:23
P550 Trace Sample
msg.txt -> Nexus Message dump
trace.txt -> Nexus Trace dump

EIC7700 firmware (bootchain)

First off, EIC7700 has several CPUs. MCPU (P550 cluster) + SCPU (E21) + LCPU (E21) + NPU and DSPs. The SCPU (Secure CPU) is used to run the Masked ROM after power on. The Masked ROM has the logic of loading different payloads from the selected boot source image and kickstarts other CPUs such as MCPU. Optionally it can also validate the cryptographic key/signature of the payload against OTP, thus implementing secure-boot. ESWIN calls the container of the payloads bootchain By default the boot source is QSPI boot flash. The bootchain is stored at the beginning of the flash (offset 0). The boot flash contains the following on my Hifive P550

  • DDR init: Vendor binary blob to initialize DDR (closed source)
  • "firmware": AFAIK, a very small piece of code that does little to nothing. Perhaps only to keep SCPU active.
  • bootloader: The usual opensbi+u-boot stuff that runs on MCPU. (open source, ESWIN maintains the patched opensbi/u-boot)

*As it's shown, the DDR init blob i

/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/applications/main.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/adma/adma_service.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/board.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/can/can_service.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/i2c/i2c_service.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/ir/ir_service.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/pm/k1x_pm.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/uart/board_uart.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/uart/ck_usart.c
/data/home/zhuxianbin/workspace/esos/esos/bsp/spacemit/drivers/uart/drv_usart.h
@ganboing
ganboing / jh7110_otp.md
Last active June 3, 2025 17:06
jh7110/vf2 OTP Dump
function FindProxyForURL(url, host)
{
ipv4 = /^\d+\.\d+\.\d+\.\d+$/;
if (ipv4.test(host) && isInNet(host, "192.168.0.0", "255.255.0.0") )
return "DIRECT"
return "SOCKS 192.168.0.10:1080";
}
function FindProxyForURL(url, host)
{
return "SOCKS 192.168.1.100:1080";
}