Repository navigation
nor: split layout on the hi3516cv500 family, hi3536dv100 and hi3516av100/dv100; sf on HiSFC350 - #62
Conversation
CONFIG_OPENIPC_NOR_SPLIT for hi3516cv500, hi3516dv300 and hi3516av300, whose kernel (OpenIPC/linux hisilicon-hi3516cv500) finds the split layout from its device tree. misc_init_r() sets verify=n before openipc_helper(). The NAND builds compile the split code out. NOR images 205136-205316 bytes; NAND images build as before.
CONFIG_OPENIPC_NOR_SPLIT for hi3536dv100, whose kernel (OpenIPC/linux hisilicon-hi3536dv100) finds the split layout from its device tree. misc_init_r() sets verify=n before openipc_helper(). NOR image: u-boot-hi3536dv100-nor.bin 144304 bytes.
CONFIG_OPENIPC_NOR_SPLIT for hi3516av100 and hi3516dv100, whose kernel (OpenIPC/linux hisilicon-hi3516av100) finds the split layout from its device tree. misc_init_r() sets verify=n before openipc_helper().
CMD_SF depended on DM_SPI_FLASH, SPI_FLASH or FMC_SPI_NOR, not on
HISFC350_SPI_NOR. openipc_config sets CMD_SF=y, but olddefconfig drops it
on every board whose flash controller is the HiSFC350: hi3516av100,
hi3516dv100, hi3516cv100, hi3518av100, hi3518cv100, hi3518ev100,
hi3515av100, hi3520av100, hi3520dv100 and hi3520dv200. Their
u-boot-<soc>-nor.bin then has no sf command. The environment still loads
and the layout scan still finds the kernel (both call the spi_flash API
directly), but bootcmd's "sf probe; sf read" fails ("Unknown command
'sf'"), bootm finds no image, and the board resets until the boot limit
leaves it at the prompt. The published hi3516av100 image (b1e0950) does
exactly that in qemu-hisilicon, on a fixed-slot image too.
The HiSFC350 driver provides spi_flash_probe() and the spi_flash ops that
cmd/sf.c calls, so sf builds against it unchanged.
Tested: hi3516av100 builds with CONFIG_CMD_SF=y (u-boot-hi3516av100-nor.bin
126152 bytes, inside the 256K boot area). In qemu-hisilicon (hi3516av100,
8 MB) bootcmd now reads the kernel and boots it, from fixed slots and from
the split layout, and fwupd's sf erase/write recovers a fixed-slot or
damaged install (byte-identical on flash). Not run on hardware.
PR Summary by QodoEnable split NOR layouts on six HiSilicon boards and restore HiSFC350 sf
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo
1.
|
From review: fwwrite writes only a file that fits ${fwsize}, the firmware
area from kernaddr to the end of the chip, and only the layout scan set
it. Removable-media recovery runs before the scan, so on a fresh
environment a script.txt that loads firmware.bin and runs fwwrite found
no fwsize and wrote nothing ("do not fit"). openipc_helper() now sets
fwsize from the probed flash before recovery, and the scan sets it again
from what it finds. Every split board's NOR build gets it; NAND and
fixed-only builds compile it out.
Tested in qemu-hisilicon (hi3516cv500, 16 MB, fixed-slot install, fresh
environment) with an SD card holding a script.txt that runs "fatload mmc
0 ${baseaddr} firmware.bin.hi3516cv500; run fwwrite": the script sees
fwsize=0xfb0000, fwwrite erases from 0x50000 to the end and writes the
image (byte-identical on flash), and the camera boots the split layout,
root on 31:4, login. Builds for hi3516cv500, hi3516av100, hi3516ev300 and
gk7205v500 with no new warnings. Not run on hardware.
…image From review: the older u-boot-<soc>-universal.bin (2010.06) that these cameras run loads the split image's kernel, which takes the device tree's layout over the fixed-slot mtdparts it is given (checked in qemu-hisilicon, hi3516av100). An -nor.bin from before OpenIPC/u-boot#62 boots nothing, so no camera runs it to upgrade from.
…mily (#622) * nor-split: the Hi3516CV500 family, Hi3536DV100 and the Hi3516AV100 family They ship the split package beside the fixed-slot one since OpenIPC/firmware#2669, on OpenIPC/linux#142, #143 and #144 and OpenIPC/u-boot#62. The Hi3516AV100 family's u-boot-<soc>-nor.bin boots only from #62 on: earlier builds had no sf command, so their bootcmd could not read the kernel. sysupgrade -k -r takes the split package on them, and they go back to fixed slots the same way. Checked in qemu-hisilicon (hi3516cv500 16 MB, hi3536dv100 and hi3516av100 8 MB). Not run on hardware. * nor-split: the Hi3516AV100 family's universal U-Boot boots the split image From review: the older u-boot-<soc>-universal.bin (2010.06) that these cameras run loads the split image's kernel, which takes the device tree's layout over the fixed-slot mtdparts it is given (checked in qemu-hisilicon, hi3516av100). An -nor.bin from before OpenIPC/u-boot#62 boots nothing, so no camera runs it to upgrade from.
* nor: split layout on the GK710x The GK7101, GK7101S, GK7102 and GK7102S kernels register the split NOR layout from the images themselves since OpenIPC/linux#152 (goke-gk710x), and OpenIPC/firmware#2692 ships gk7102 and gk7102s split packages. This U-Boot booted them only because it loads the kernel from 0x50000; it had no split scan, fwupd or recovery for them. - common/openipc.c as on openipc-hisilicon now: the split scan, the kernel CRC check that sends a damaged split kernel to recovery (#56), fwsize set before recovery (#62), verify dropped for recovery only, the saved-environment migrations. One change: the fallback kernel offset is OPENIPC_KERNADDR, which both branches define, rather than CONFIG_ENV_KERNADDR, an ad-hoc CONFIG_ this branch's check-config refuses (openipc-hisilicon turned that check off). - common/Kconfig: OPENIPC_NOR_SPLIT, enabled in the four gk710x configs. - openipc-common.h: with it, fwupd takes firmware.bin.<soc> when the server has one and writes it over the whole firmware area (fwwrite refuses a file that does not fit), else the fixed-slot pair as before; the legacy fwupd is this branch's "run mtdslite; run ur; run uk". OPENIPC_FW_FILE was "firmware.${soc}", never used until now and naming no file any package carries; it is now "firmware.bin." CONFIG_PRODUCT_SOC, spelled out at build time as urfile is, since U-Boot does not expand a variable inside another's value. Tested in qemu-hisilicon (gk7102, 8 MB, 64 MB RAM; the flash byte-swapped as the controller stores it) with a gk7102_lite build on the split kernel (firmware.bin 5248K): - split image: "Found Kernel at 0x00050000", "Found RootFS at 0x001b0000", the kernel's split layout, root on 31:4; a second boot reads the seed the first saved in the overlay; - fixed slots: found at 0x250000, 6 cmdlinepart partitions, root on 31:3; - fwupd over TFTP from fixed slots: firmware.bin.gk7102 fetched, the firmware area erased and written, the split layout booted; - a split kernel with one byte flipped: "fails its CRC", recovery fetches and writes firmware.bin.gk7102, the split layout booted; - after both, the flash at 0x50000 is byte-identical to firmware.bin. Built for gk7101, gk7101s, gk7102 and gk7102s; only gk7102 run. Not run on hardware. * nor: an oversized firmware file falls back to the fixed-slot pair fwupd took the firmware file whenever the download succeeded, and fwwrite then refused one larger than the firmware area and wrote nothing: recovery reset and fetched the same file again. fwupd now runs fwwrite only for a file that downloaded and fits (0 < filesize <= fwsize), and otherwise installs the fixed-slot pair, as for a missing file. qemu-hisilicon (gk7102): a 9 MB firmware.bin.gk7102 beside the pair on the server -> the pair written at 0x250000 and 0x50000, fixed slots booted (root on 31:3); a firmware.bin that fits -> written at 0x50000, the split layout booted (root on 31:4).
Four commits.
1.
cmd: sf builds on the HiSFC350 boardsfixes a bug unrelated to the split layout.CMD_SFdepended onDM_SPI_FLASH || SPI_FLASH || FMC_SPI_NOR, but notHISFC350_SPI_NOR. Soolddefconfigdrops theCMD_SF=yfromopenipc_configon every HiSFC350 board: hi3516av100, hi3516dv100, hi3516cv100, hi3518av100, hi3518cv100, hi3518ev100, hi3515av100, hi3520av100, hi3520dv100 and hi3520dv200.u-boot-<soc>-nor.binhas nosf. The env still loads and the layout scan still finds the kernel, because both call thespi_flashAPI directly. But bootcmd'ssf probe; sf readfails,bootmfinds no image, and the board resets until the boot limit leaves it at the prompt.u-boot-hi3516av100-nor.bin(b1e0950) does exactly that, even on a fixed-slot image.spi_flash_probe()and opscmd/sf.ccalls, sosfbuilds against it unchanged.2–4.
CONFIG_OPENIPC_NOR_SPLITfor families whose kernels now find the split layout from their device tree. Each board'smisc_init_r()now setsverify=nbeforeopenipc_helper(), as #52 and #61 did. Fixed-slot cameras boot as before, and the NAND builds compile the split code out.hi3516cv500_config,hi3516dv300_config,hi3516av300_confighi3536dv100_confighi3516av100_config,hi3516dv100_configNOR images, all inside the 256K boot area: cv500 205144, dv300/av300 205328, 36dv100 144216, av100/dv100 126236 bytes.
Tested in qemu-hisilicon with each family's lite build on its new kernel. hi3516cv500 runs on 16 MB flash, the other two on 8 MB.
fwupdover TFTP from fixed slotsfails its CRC→ recoveryOn hi3516av100, qemu-hisilicon's model stops the boot after the MTD probe, before root is mounted. It does that on either layout, and with the kernel OpenIPC ships today too. Not run on hardware.