{"id":30664515,"url":"https://github.com/flipperdevices/rk3576-linux-build","last_synced_at":"2025-08-31T19:03:26.265Z","repository":{"id":311359094,"uuid":"1029783379","full_name":"flipperdevices/rk3576-linux-build","owner":"flipperdevices","description":"Test builds for RK3576","archived":false,"fork":false,"pushed_at":"2025-08-24T10:06:46.000Z","size":1404,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2025-08-24T10:30:04.037Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flipperdevices.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-31T15:07:36.000Z","updated_at":"2025-08-24T09:34:35.000Z","dependencies_parsed_at":"2025-08-24T10:39:08.706Z","dependency_job_id":"5d215e98-2d6c-4f0d-8aae-c0daffbdbc4c","html_url":"https://github.com/flipperdevices/rk3576-linux-build","commit_stats":null,"previous_names":["flipperdevices/rk3576-linux-build"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/flipperdevices/rk3576-linux-build","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipperdevices%2Frk3576-linux-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipperdevices%2Frk3576-linux-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipperdevices%2Frk3576-linux-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipperdevices%2Frk3576-linux-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flipperdevices","download_url":"https://codeload.github.com/flipperdevices/rk3576-linux-build/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipperdevices%2Frk3576-linux-build/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273025829,"owners_count":25032842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-31T19:03:25.632Z","updated_at":"2025-08-31T19:03:26.259Z","avatar_url":"https://github.com/flipperdevices.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux system image build scripts for RK3576 based boards\n\nThe scripts in this repository produce disk images for Rockchip RK3576 based boards, ready to be flashed to an SD card or uploaded to internal storage via a USB connection and Maskrom mode.\n\nThey are meant to be run on a Debian 13 (trixie) or later systems. It's probably possible to use different distributions too, but you'll need to find the right prerequisites yourself. Your mileage may vary.\n\n\n## Quick start with Docker\n\n**TODO**: Move to Docker Hub\n\n```bash\n# Clone repo \ngit clone https://github.com/flipperdevices/rk3576-linux-build \ncd rk3576-linux-build\n\n# Build docker image and start container\ndocker build -t rk3576-linux-build .\ndocker run --privileged --rm -v $(pwd)/out:/artifacts \\\n\t-e UBOOT_GIT=https://source.denx.de/u-boot/contributors/kwiboo/u-boot.git \\\n\t-e UBOOT_BRANCH=rk3576 \\\n\trk3576-linux-build\n\n# Flash image to Radxa 4D MicroSD card via USB\n\n# 1. Switch Radxa 4D into Maskrom mode and verify it\n# rockusb should work inside Docker container becuase of privileged mode\nrockusb list\n\n# 2. Upload bootloader to Radxa 4D\nrockusb download-boot out/u-boot/rock-4d/rk3576_spl_loader_*.bin\n\n# 3. Flash image to MicroSD card\nrockusb write-bmap out/images/debian-rock-4d-20250824-0021.img.gz\n\n# 4. Reboot the board\nrockusb reset-device\n```\n\n\n## Prepare build system manually\n\nFor building the bootloader:\n\n```bash\nsudo apt install git build-essential crossbuild-essential-arm64 bison flex python3-dev python3-libfdt python3-setuptools swig libssl-dev gnutls-dev python3-pyelftools\n```\n\nFor building the kernel:\n\n```bash\nsudo dpkg --add-architecture arm64\nsudo apt update\nsudo apt install git build-essential crossbuild-essential-arm64 bc bison flex libssl-dev libdw-dev libelf-dev debhelper libssl-dev:arm64 rsync\n```\n\nFor fetching vendor DTS files (if using a Rockchip BSP kernel):\n\n```bash\nsudo apt install wget gdown repo\n```\n\nFor assembling complete disk images:\n\n```bash\nsudo apt install debos systemd-resolved bmap-tools pigz\n```\n\nFor uploading images over USB:\n\n```bash\nsudo apt install rockusb\n```\n\n## Building Linux kernel packages\n\n### Mainline kernel\n\nTo simply fetch and build the most recent mainline Linux kernel:\n\n```bash\n./build-kernel-mainline.sh\n```\n\nTo rebuild without re-downloading:\n\n```bash\nKEEP_SRC=yes ./build-kernel-mainline.sh\n```\n\nTo incrementally update downloaded sources without full fresh clone:\n\n```bash\nKEEP_SRC=update ./build-kernel-mainline.sh\n```\n\nTo download and build a mainline-based Linux kernel from any repo other than Linus Torvalds' master branch:\n\n```bash\nLINUX_GIT=https://gitlab.collabora.com/hardware-enablement/rockchip-3588/linux.git LINUX_BRANCH=rockchip-devel ./build-kernel-mainline.sh\n```\n\n### BSP kernel\n\nTo simply fetch and build the most recent Rockchip publicly released kernel:\n\n```bash\n./build-kernel-bsp.sh\n```\n\nTo rebuild without re-downloading:\n\n```bash\nKEEP_SRC=yes ./build-kernel-bsp.sh\n```\n\nTo incrementally update downloaded sources without full fresh clone:\n\n```bash\nKEEP_SRC=update ./build-kernel-bsp.sh\n```\n\n## Building bootloader images\n\nTo simply fetch and build the most recent upstream U-boot with opensource TF-A:\n\n```bash\n./build-uboot.sh\n```\n\nPlease note that as of August 2025, the only RK3576 based board supported by the unmodified upstream U-boot is Firefly ROC-RK3576-PC.\n\nTo build for other boards, alternative U-boot source trees can be used, such as:\n\n```bash\nBOARD=sige5 UBOOT_GIT=\"https://source.denx.de/u-boot/contributors/kwiboo/u-boot.git\" UBOOT_BRANCH=\"rk3576\" ./build-uboot.sh\nBOARD=omni3576 KEEP_SRC=yes ./build-uboot.sh\nBOARD=nanopi-m5 KEEP_SRC=yes ./build-uboot.sh\nBOARD=rock-4d KEEP_SRC=yes ./build-uboot.sh\n```\n\nTo use Rockchip binary BL31 instead of opensource TF-A:\n\n```bash\nUSE_BL31=vendor BOARD=sige5 UBOOT_GIT=\"https://source.denx.de/u-boot/contributors/kwiboo/u-boot.git\" UBOOT_BRANCH=\"rk3576\" ./build-uboot.sh\nUSE_BL31=vendor BOARD=omni3576 KEEP_SRC=yes ./build-uboot.sh\nUSE_BL31=vendor BOARD=nanopi-m5 KEEP_SRC=yes ./build-uboot.sh\nUSE_BL31=vendor BOARD=rock-4d KEEP_SRC=yes ./build-uboot.sh\n```\n\n## Assembling full disk images for SD/eMMC\n\nPlease note that as of August 2025, upstream U-boot doesn't have a driver for the Rockchip UFS controller, so it cannot boot from UFS.\n\nPrepare the kernel and U-boot images per the above instructions, then run:\n\n```bash\n./build-images.sh\n```\n\nIt will produce compressed disk images for all boards for which you have compiled U-boot images. Linux kernel and root filesystem images will be the same in all of them.\n\n## Writing the full disk image to SD/MMC\n\n### Flashing to an SD card\n\nTo produce a bootable SD card with your newly built Debian image, connect it to your host computer (e.g. through a card reader).\n\nIf you have a built-in SD card slot, you may use that, and the card will likely show up as `/dev/mmcblkX` (where `X` is the number identifying the respective SD/MMC controller, likely `0` if you only have one).\n\nIf you are using a USB card reader, the card will likely show up as `/dev/sdX` (where `X` is a lowercase letter). In this latter case you need to be triple careful, because any SATA or SCSI storage devices will also share the same naming scheme, and if you have important data on any other `/dev/sdX` device (such as your main system disk being called something like `/dev/sda`) you might end up inadvertently overwriting it if you pick the wrong one in the below commands, losing all your data. Please be careful.\n\n```bash\nsudo bmaptool copy out/debian-\u003cyour_board\u003e.img.gz /dev/sdX\n```\n\n### Flashing to eMMC using a USB cable and Maskrom\n\nRockchip devices include a special built-in mode called Maskrom, which allows flashing the board over a USB connection even if the board contains no bootloader or it is corrupted.\n\nThis mode is activated by holding down a MASKROM button when the power supply gets connected.\n\n- Instructions for Radxa Rock 4D: https://docs.radxa.com/en/rock4/rock4d/hardware-use/maskrom?maskrom-display=Linux%2FMacOS. Connect a USB A to A cable (or Type C to USB A, depending on you host computer’s available USB ports) to the top USB 3.0 blue port, hold the MASKROM button and apply power to the board as usual via its Type C DC IN. Note that eMMC modules cannot be used together with the onboard SPI flash, as they share pins internally\n- Instructions for ArmSoM Sige5: https://docs.armsom.org/getting-start/flash-img#241-device-connection. Connect a USB A to Type C cable (or Type C to Type C, depending on your host computer’s available USB ports) to the Type C OTG port (marked TYPEC on the board), hold the MASKROM button and apply power to the board as usual via its Type C DC IN\n\nYou should then see something like this in `lsusb` command output:\n\n```bash\nBus 002 Device 011: ID 2207:350e Fuzhou Rockchip Electronics Company\n```\n\nYour device is now ready for programming over the Rockusb protocol.\n\n```bash\n# Boot the board in USB upload mode\nsudo rockusb download-boot prebuilt/u-boot/\u003cyour_board\u003e/rk3576_spl_loader_*.bin\n\nsudo rockusb write-bmap out/debian-\u003cyour_board\u003e.img.gz\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflipperdevices%2Frk3576-linux-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflipperdevices%2Frk3576-linux-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflipperdevices%2Frk3576-linux-build/lists"}