Skip to content

rostelecom-ipc8232swc-we: catch up with firmware, keep wired DHCP, find the SD card - #192

Merged
openipc-ai merged 2 commits into
masterfrom
ipc8232swc-we-modernize
Oct 12, 2026
Merged

openipc-ai merged 2 commits into
masterfrom
ipc8232swc-we-modernize

Conversation

@openipc-ai

Copy link
Copy Markdown
Contributor

Problem

The Rostelecom IPC8232SWC-WE profile had drifted from firmware, and three of its first-boot settings break the camera:

  • No SD card, ever. Slot power is GPIO38, which muxes.sh raises from S30customizer. The kernel scanned mmc0 at init, while the slot was still unpowered. This board's card-detect bit never changes, so nothing scans again. The card was invisible to both the kernel and the vendor U-Boot ("Card did not respond to voltage select").
  • No network on a wired camera. customizer.sh did fw_setenv wlandev rtl8188fu-generic. With wlandev set, S40network never runs ifup eth0; it gives the wired port the static fallback 192.168.2.10. With no WiFi credentials, a camera on Ethernet was unreachable from its first boot.
  • Wrong upgrade package. upgrade was pinned to …-nor.tgz, and sysupgrade reads it ahead of its own default (<BUILD_PLATFORM>-<nor|nand>.tgz), so this NAND camera would be sent to the NOR package.

The rest is drift:

  • rootfs.ubi was ubinized from a device copy of the old NAND layout: a separate kernel volume and a squashfs rootfs. Firmware#2537 moved the family to one UBIFS rootfs with /boot/fitImage inside, so a fresh install from this image could not boot. Sysupgrade writes rootfs.ubifs and was not affected. rvi-1ncmw2028 carries the identical copy, so it gets the same one-line fix.
  • load_hisilicon was a Feb 2025 snapshot that forced mmz_allocator=hisi. Since then firmware has added the cipher engine, HWRNG, the sensor=unknown latch fix (#2428), the device-tree DDR fallback and CMA zone handling.
  • The defconfig still selected LIBWEBSOCKETS_OPENIPC, a package firmware removed in #2503.
  • totalmem, osmem and sensor in the customizer are no longer needed. Firmware reads the DDR size from the device tree and defaults osmem to 32M, which gives the 96M CMA zone. The SP2305 is autodetected: it reads as ov2735, and firmware ships ov2735_i2c_1080p.ini -> sp2305_i2c_1080p.ini.

Changes

  • Defconfig: firmware's hi3516ev300_ultimate_defconfig, minus divinus, motors, majestic-af and the MT7601U/8188EU WiFi packages, plus this camera's RTL8188FU. UBI config points at $(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/ubinize-nand.cfg; the same change for rvi-1ncmw2028.
  • Deleted: both ubinize_hisilicon.cfg copies, this device's load_hisilicon and its firmware-drift.json entry. The RVi's own load_hisilicon fork is left alone, because I have no RVi to test it on.
  • customizer.sh: no wlandev (the WiFi lines stay commented, for owners who want WiFi), no upgrade, totalmem, osmem or sensor.
  • muxes.sh: after gpio set 38, rebind 10010000.sdhci, only when mmc0 has no card. A card the kernel already holds is never touched (cf. zenointel-sd-2n-4g: stop re-muxing the SD pad under a live card #188).
  • Excludes: drop the three WDR/ IMX335 profiles firmware no longer ships.

Hardware tested on

The device itself: lab IPC8232SWC-WE (Hi3516EV300 + SP2305, 128 MB NAND, 64 GB SDXC card). The image was built locally from this branch over firmware 3fbc75ec with BUILD_PLATFORM set as CI sets it, and flashed with sysupgrade -k -r --force_soc --archive=. Before the flash, /etc/custom.ok and the old customizer's env were cleared, so the customizer ran a real first boot. The overlay (password, EULA record) was kept.

One caveat: the flashed image still had fw_setenv totalmem 128M in its customizer. I checked dropping it by clearing totalmem on the camera and rebooting. The commit's customizer differs from the flashed one only by that deleted line.

rvi-1ncmw2028 is not hardware-tested; its change is the UBI config path only.

Evidence

Before, the first boot of an image with the old customizer (serial console; env afterwards held wlandev=rtl8188fu-generic):

root@hi3516ev300-ov2735:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 5A:8C:A8:5F:DD:F8
          inet addr:192.168.2.10  Bcast:192.168.2.255  Mask:255.255.255.0

Before, the SD slot: every command times out at every clock, as long as GPIO38 is low (kprobe on mmc_request_done):

op=52 err=-110 / op=0 err=0 / op=8 arg=0x1aa err=-110 / op=5 err=-110 / op=55 err=-110 / op=1 err=-110   (at 400, 300, 200, 100 kHz)

After, first boot of this branch's image (UART, then ssh):

Run customizer script...
Run custom muxes & gpios preset script...
Starting network...
udhcpc: started, v1.36.1
hisilicon: Get data from ipcinfo and set SENSOR as ov2735
# ifconfig eth0 | grep inet; ip r | head -1
          inet addr:10.216.128.87  Bcast:10.216.128.255  Mask:255.255.255.0
default via 10.216.128.1 dev eth0
# dmesg | grep -E "mmc0: new|mmcblk0"
mmc0: new high speed SDXC card at address aaaa
mmcblk0: mmc0:aaaa SD64G 59.5 GiB
 mmcblk0: p1
# mount | grep mmc
/dev/mmcblk0p1 on /mnt/mmcblk0p1 type vfat (rw,relatime,...)
# fw_printenv | grep -E "^(wlandev|osmem|sensor|totalmem|upgrade)="
sensor=ov2735
# grep -o "mmz=[^ ]*" /proc/cmdline
mmz=anonymous,0,0x42000000,96M
# lsmod | grep -oE "^(open_cipher|open_hwrng|exfat)"
open_cipher
open_hwrng
exfat
# logread | grep -E "Autodetected|libsns"
majestic: Autodetected sensor as 'ov2735_i2c'
majestic: trying to load /usr/lib/sensors/libsns_sp2305.so

sensor=ov2735 is the value load_hisilicon stores after autodetect.

RTSP stream=0, 5 s over TCP: codecs ['H264/90000', 'opus/48000/2', 'vnd.onvif.metadata/90000'], 652 video and 498 audio RTP packets, about 1.1 Mbit/s. /image.jpg is a 1920x1080 colour picture.

The same results after a further reboot with totalmem cleared: no totalmem in env, the same 96M zone, majestic streaming, card mounted.

WiFi still works when asked for: modprobe 8188fu brings up wlan0 (USB 0bda:f179), and a scan finds 13 networks.

Image size: uImage 2005/2048 KB, rootfs.ubi 16384/24576 KB, squashfs 7152/8192 KB. ci-matrix.py --self-test and check-firmware-drift.py --self-test pass. The selector narrows to the two ev300 devices.

Not changed

  • majestic logs set_gpio(28, 0) error once at start; the second call a second later succeeds. That is majestic's, not this profile's.
  • Reflashing a device-profile NAND camera from a local --archive needs --force_soc in current firmware, and an archive stored on the SD card cannot work at all. sysupgrade unmounts the card first. Both are firmware issues.

…nd the SD card

- Build rootfs.ubi from firmware's family ubinize-nand.cfg (#2537
  layout) instead of a device copy of the old kernel-volume + squashfs
  layout; same for rvi-1ncmw2028, which carried the identical copy.
- Drop the forked load_hisilicon, a Feb 2025 snapshot that forced the
  hisi allocator and lacks everything firmware fixed since.
- Defconfig follows firmware's hi3516ev300_ultimate minus hardware this
  camera lacks; drops the dead LIBWEBSOCKETS_OPENIPC symbol.
- customizer.sh: stop setting wlandev (it turns off DHCP on eth0), the
  -nor.tgz upgrade URL (wrong package on NAND), and totalmem, osmem and
  sensor (firmware derives all three now).
- muxes.sh: rebind the SD host after powering the slot; the kernel
  scanned it unpowered and card detect never changes.
- Excludes: drop the three WDR/ profiles firmware no longer ships.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Modernize IPC8232SWC-WE firmware profile and restore first-boot access

🐞 Bug fix ✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Restore wired DHCP and detect SD cards after the slot receives power.
• Use firmware’s NAND layout and driver loader so fresh images boot with current firmware.
• Remove obsolete boot settings, package selections, and sensor-profile exclusions.
Diagram

graph TD
  Config["Device defconfigs"] --> NAND["Firmware NAND layout"] --> UBI["Bootable UBI image"]
  Customizer["First-boot customizer"] --> Network["Wired DHCP"]
  Customizer --> Loader["Firmware driver loader"]
  Muxes["GPIO mux script"] --> SD["SD host rescan"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Maintain synchronized device-local firmware copies
  • ➕ Pins known driver-loader and NAND-layout behavior independently of upstream changes.
  • ➖ Requires repeated reconciliation and risks missing upstream boot and driver fixes.

Recommendation: Use the shared firmware layout and loader as proposed: the stale copies already caused boot incompatibility and missed loader fixes. Retain the board-specific SD power and rescan logic locally; validate the RVi image separately because its hardware was not tested.

Files changed (6) +23 / -26

Bug fix (3) +21 / -12
customizer.shAvoid first-boot settings that block Ethernet and NAND upgrades +12/-11

Avoid first-boot settings that block Ethernet and NAND upgrades

• Stops setting wlandev so wired startup can use DHCP, and removes the NOR-only upgrade URL. Leaves memory sizing and sensor selection to current firmware defaults and autodetection; WiFi setup remains available as commented guidance.

devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh

muxes.shDetect SD cards after enabling slot power +8/-0

Detect SD cards after enabling slot power

• Conditionally unbinds and rebinds the SDHCI host after powering GPIO38, prompting a scan when mmc0 has no card. It leaves an already detected card untouched.

devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/muxes.sh

hi3516ev300_ultimate_rvi-1ncmw2028_defconfigUse the shared NAND layout for the RVi image +1/-1

Use the shared NAND layout for the RVi image

• Points UBI generation to firmware’s family NAND configuration instead of the same obsolete device-local layout. No RVi hardware validation is reported.

devices/hi3516ev300_ultimate_rvi-1ncmw2028/br-ext-chip-hisilicon/configs/hi3516ev300_ultimate_rvi-1ncmw2028_defconfig

Other (3) +2 / -14
firmware-drift.jsonStop tracking the removed Rostelecom loader fork +0/-7

Stop tracking the removed Rostelecom loader fork

• Removes the drift record for the IPC8232SWC-WE loader copy now that the profile uses firmware’s loader. The RVi fork remains tracked.

.github/firmware-drift.json

hi3516ev300_ultimate_rostelecom-ipc8232swc-we_defconfigSelect the current NAND layout and reconcile packages +2/-4

Select the current NAND layout and reconcile packages

• Points UBI generation to firmware’s family NAND configuration instead of the obsolete device copy. Removes explicit curl, mbedTLS, and removed libwebsockets selections and adds UACME while retaining RTL8188FU.

devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/br-ext-chip-hisilicon/configs/hi3516ev300_ultimate_rostelecom-ipc8232swc-we_defconfig

hi3516ev300_ultimate.listRemove exclusions for absent IMX335 WDR profiles +0/-3

Remove exclusions for absent IMX335 WDR profiles

• Drops three WDR sensor-profile paths that current firmware no longer ships.

devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/scripts/excludes/hi3516ev300_ultimate.list

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. The camera lacks an explicit update URL 📘 Rule violation ≡ Correctness
Description
customizer.sh removes the fw_setenv upgrade assignment instead of configuring an update URL
ending in the device artifact name. On first boot, self-update relies on sysupgrade's fallback
rather than the required device-specific setting.
Code

devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[R11-14]

+# No `upgrade` URL: the -nor.tgz pinned here sent this NAND camera to the
+# NOR package, because sysupgrade reads `upgrade` ahead of its own default.
+# That default is <BUILD_PLATFORM>-<nor|nand>.tgz on builder, picked by the
+# flash the camera has.
Evidence
The checklist requires the customizer to set an appropriate upgrade URL ending in the device
artifact suffix. The changed customizer deletes the existing fw_setenv upgrade command and
explicitly documents that no URL is configured.

CLAUDE.md: Configure First-Boot Settings for the Target Device: CLAUDE.md: Configure First-Boot Settings for the Target Device: CLAUDE.md: Configure First-Boot Settings for the Target Device: CLAUDE.md: Configure First-Boot Settings for the Target Device
devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[11-14]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The first-boot customizer no longer sets the device-specific `upgrade` URL, contrary to the required self-update configuration.
## Fix Focus Areas
- devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[11-14]
## Recommended Fix
Set `upgrade` to the correct device artifact URL required by the compliance policy, ensuring the filename matches the package intended for this device.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Upgraded cameras keep faulty boot values 🐞 Bug ≡ Correctness
Description
customizer.sh stops writing upgrade and wlandev but never removes values that an earlier
version wrote to the persistent U-Boot environment. When an existing camera is upgraded, the old NOR
upgrade URL remains selected and the old Wi-Fi setting continues to prevent wired DHCP, even if the
customizer runs again.
Code

devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[14]

-fw_setenv upgrade 'https://github.com/OpenIPC/builder/releases/download/latest/hi3516ev300_ultimate_rostelecom-ipc8232swc-we-nor.tgz'
+# No `upgrade` URL: the -nor.tgz pinned here sent this NAND camera to the
+# NOR package, because sysupgrade reads `upgrade` ahead of its own default.
+# That default is <BUILD_PLATFORM>-<nor|nand>.tgz on builder, picked by the
+# flash the camera has.
Evidence
The old writes are removed rather than reversed. The repository documents the customizer as a
first-boot script, and another profile explicitly notes that an upgrade must wipe /etc/custom.ok
for its customizer to run again. The changed comments identify the effects of the two retained
values; the environment is stored separately from the root filesystem.

devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[11-14]
devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[35-40]
CLAUDE.md[61-66]
devices/hi3516ev300_lite_xm-85h50ai/general/overlay/usr/share/openipc/customizer.sh[34-38]
devices/ssc325_lite_chuangmi-ipc017/general/overlay/etc/init.d/S01fwenv[3-15]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Existing cameras retain the old `upgrade` and `wlandev` U-Boot variables after updating; deleting their writes only helps a clean environment.
## Fix Focus Areas
- devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[11-14]
- devices/hi3516ev300_ultimate_rostelecom-ipc8232swc-we/general/overlay/usr/share/openipc/customizer.sh[35-38]
## Recommended Fix
Add an upgrade-time migration that removes the specific legacy NOR URL and `rtl8188fu-generic` value when present, without overwriting user-selected values. Ensure it can run on devices where `/etc/custom.ok` already exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab)

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

…e pinned

customizer.sh runs once, so cameras set up by an earlier version of this
profile keep its -nor.tgz upgrade URL, which a NAND camera cannot install.
muxes.sh runs every boot; it clears the URL only while it is exactly that
one.
@openipc-ai
openipc-ai merged commit a8f0e0c into master Oct 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant