forked from siderolabs/sbc-rockchip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# This is a combination of 5 commits.
# This is the 1st commit message: feat: Orange PI 5 Setup the folder structure for Orange PI 5 # This is the commit message siderolabs#2: feat: Orange PI 5 First attempt, not looking good :sad: # This is the commit message siderolabs#3: feat: Orangi PI 5 - Use mainline # This is the commit message siderolabs#4: feat: Orange PI 5 # This is the commit message siderolabs#5: fix: cleanup
- Loading branch information
Showing
19 changed files
with
684 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"arrterian.nix-env-selector", | ||
"esbenp.prettier-vscode", | ||
"exiasr.hadolint", | ||
"github.copilot", | ||
"github.copilot-chat", | ||
"github.vscode-github-actions", | ||
"kamadorueda.alejandra", | ||
"mkhl.direnv", | ||
"ms-azuretools.vscode-docker", | ||
"nhoizey.gremlins", | ||
"johnpapa.vscode-peacock", | ||
"pinage404.nix-extension-pack", | ||
"redhat.vscode-yaml", | ||
"streetsidesoftware.code-spell-checker", | ||
"supermaven.supermaven", | ||
"tekumura.typos-vscode", | ||
"timonwong.shellcheck", | ||
"tuxtina.json2yaml", | ||
"vscodevim.vim", | ||
"wakatime.vscode-wakatime", | ||
"yzhang.markdown-all-in-one", | ||
"ms-vscode.makefile-tools" | ||
] | ||
} | ||
}, | ||
"image": "ghcr.io/cachix/devenv:latest", | ||
"overrideCommand": false, | ||
"updateContentCommand": "devenv test" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
{ | ||
inputs = | ||
let | ||
version = "1.0.8"; | ||
system = "x86_64-linux"; | ||
devenv_root = "/home/mahdtech/Projects/GitHub/MAHDTech/sbc-rockchip"; | ||
devenv_dotfile = ./.devenv; | ||
devenv_dotfile_string = ".devenv"; | ||
container_name = null; | ||
devenv_tmpdir = "/run/user/1000/"; | ||
devenv_runtime = "/run/user/1000/devenv-e62ce0a"; | ||
devenv_istesting = false; | ||
|
||
in { | ||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; | ||
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; | ||
nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling"; | ||
devenv.url = "github:cachix/devenv?dir=src/modules"; | ||
} // (if builtins.pathExists (devenv_dotfile + "/flake.json") | ||
then builtins.fromJSON (builtins.readFile (devenv_dotfile + "/flake.json")) | ||
else { }); | ||
|
||
outputs = { nixpkgs, ... }@inputs: | ||
let | ||
version = "1.0.8"; | ||
system = "x86_64-linux"; | ||
devenv_root = "/home/mahdtech/Projects/GitHub/MAHDTech/sbc-rockchip"; | ||
devenv_dotfile = ./.devenv; | ||
devenv_dotfile_string = ".devenv"; | ||
container_name = null; | ||
devenv_tmpdir = "/run/user/1000/"; | ||
devenv_runtime = "/run/user/1000/devenv-e62ce0a"; | ||
devenv_istesting = false; | ||
|
||
devenv = | ||
if builtins.pathExists (devenv_dotfile + "/devenv.json") | ||
then builtins.fromJSON (builtins.readFile (devenv_dotfile + "/devenv.json")) | ||
else { }; | ||
getOverlays = inputName: inputAttrs: | ||
map | ||
(overlay: | ||
let | ||
input = inputs.${inputName} or (throw "No such input `${inputName}` while trying to configure overlays."); | ||
in | ||
input.overlays.${overlay} or (throw "Input `${inputName}` has no overlay called `${overlay}`. Supported overlays: ${nixpkgs.lib.concatStringsSep ", " (builtins.attrNames input.overlays)}")) | ||
inputAttrs.overlays or [ ]; | ||
overlays = nixpkgs.lib.flatten (nixpkgs.lib.mapAttrsToList getOverlays (devenv.inputs or { })); | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
config = { | ||
allowUnfree = devenv.allowUnfree or false; | ||
allowBroken = devenv.allowBroken or false; | ||
permittedInsecurePackages = devenv.permittedInsecurePackages or [ ]; | ||
}; | ||
inherit overlays; | ||
}; | ||
lib = pkgs.lib; | ||
importModule = path: | ||
if lib.hasPrefix "./" path | ||
then if lib.hasSuffix ".nix" path | ||
then ./. + (builtins.substring 1 255 path) | ||
else ./. + (builtins.substring 1 255 path) + "/devenv.nix" | ||
else if lib.hasPrefix "../" path | ||
then throw "devenv: ../ is not supported for imports" | ||
else | ||
let | ||
paths = lib.splitString "/" path; | ||
name = builtins.head paths; | ||
input = inputs.${name} or (throw "Unknown input ${name}"); | ||
subpath = "/${lib.concatStringsSep "/" (builtins.tail paths)}"; | ||
devenvpath = "${input}" + subpath; | ||
devenvdefaultpath = devenvpath + "/devenv.nix"; | ||
in | ||
if lib.hasSuffix ".nix" devenvpath | ||
then devenvpath | ||
else if builtins.pathExists devenvdefaultpath | ||
then devenvdefaultpath | ||
else throw (devenvdefaultpath + " file does not exist for input ${name}."); | ||
project = pkgs.lib.evalModules { | ||
specialArgs = inputs // { inherit inputs pkgs; }; | ||
modules = [ | ||
(inputs.devenv.modules + /top-level.nix) | ||
{ | ||
devenv.cliVersion = version; | ||
devenv.root = devenv_root; | ||
devenv.dotfile = devenv_root + "/" + devenv_dotfile_string; | ||
} | ||
(pkgs.lib.optionalAttrs (inputs.devenv.isTmpDir or false) { | ||
devenv.tmpdir = devenv_tmpdir; | ||
devenv.runtime = devenv_runtime; | ||
}) | ||
(pkgs.lib.optionalAttrs (inputs.devenv.hasIsTesting or false) { | ||
devenv.isTesting = devenv_istesting; | ||
}) | ||
(pkgs.lib.optionalAttrs (container_name != null) { | ||
container.isBuilding = pkgs.lib.mkForce true; | ||
containers.${container_name}.isBuilding = true; | ||
}) | ||
] ++ (map importModule (devenv.imports or [ ])) ++ [ | ||
./devenv.nix | ||
(devenv.devenv or { }) | ||
(if builtins.pathExists ./devenv.local.nix then ./devenv.local.nix else { }) | ||
]; | ||
}; | ||
config = project.config; | ||
|
||
options = pkgs.nixosOptionsDoc { | ||
options = builtins.removeAttrs project.options [ "_module" ]; | ||
# Unpack Nix types, e.g. literalExpression, mDoc. | ||
transformOptions = | ||
let isDocType = v: builtins.elem v [ "literalDocBook" "literalExpression" "literalMD" "mdDoc" ]; | ||
in lib.attrsets.mapAttrs (_: v: | ||
if v ? _type && isDocType v._type then | ||
v.text | ||
else if v ? _type && v._type == "derivation" then | ||
v.name | ||
else | ||
v | ||
); | ||
}; | ||
in | ||
{ | ||
packages."${system}" = { | ||
optionsJSON = options.optionsJSON; | ||
inherit (config) info procfileScript procfileEnv procfile; | ||
ci = config.ciDerivation; | ||
}; | ||
devenv = config; | ||
devShell."${system}" = config.shell; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: arm-trusted-firmware-rk3588 | ||
variant: scratch | ||
shell: /toolchain/bin/bash | ||
dependencies: | ||
- stage: base | ||
steps: | ||
- sources: | ||
- url: https://github.com/ARM-software/arm-trusted-firmware/archive/{{ .arm_trusted_firmware_unstable_commit }}.tar.gz | ||
destination: arm-trusted-firmware.tar.gz | ||
sha256: "{{ .arm_trusted_firmware_unstable_sha256 }}" | ||
sha512: "{{ .arm_trusted_firmware_unstable_sha512 }}" | ||
env: | ||
SOURCE_DATE_EPOCH: {{.BUILD_ARG_SOURCE_DATE_EPOCH}} | ||
prepare: | ||
- | | ||
mkdir -p /usr/bin \ | ||
&& ln -sf /toolchain/bin/env /usr/bin/env | ||
pip3 install setuptools | ||
tar xf arm-trusted-firmware.tar.gz --strip-components=1 | ||
# rk3588 | ||
build: | ||
- | | ||
# https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/getting_started/initial-build.rst | ||
export CROSS_COMPILE=/toolchain/bin/aarch64-linux-musl- | ||
make realclean | ||
# https://salsa.debian.org/debian/arm-trusted-firmware/-/commit/6424a59e08585af7f8a56f1e16ecc6a6b9e4ad7a | ||
# https://developer.trustedfirmware.org/T996 | ||
CFLAGS=--param=min-pagesize=0 make -j $(nproc) PLAT=rk3588 DEBUG=0 bl31 | ||
install: | ||
- | | ||
mkdir -p /rootfs/arm-trusted-firmware/rk3588 | ||
cp build/rk3588/release/bl31/bl31.elf /rootfs/arm-trusted-firmware/rk3588/bl31.elf | ||
finalize: | ||
- from: /rootfs | ||
to: /libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h | ||
index a4cb3bfde5..0ecd088f4a 100644 | ||
--- a/include/linux/byteorder/little_endian.h | ||
+++ b/include/linux/byteorder/little_endian.h | ||
@@ -7,7 +7,10 @@ | ||
#ifndef __LITTLE_ENDIAN_BITFIELD | ||
#define __LITTLE_ENDIAN_BITFIELD | ||
#endif | ||
+ | ||
+#ifndef __BYTE_ORDER | ||
#define __BYTE_ORDER __LITTLE_ENDIAN | ||
+#endif | ||
|
||
#include <linux/compiler.h> | ||
#include <linux/types.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# References: | ||
# U-Boot: | ||
# - https://u-boot.readthedocs.io/en/latest | ||
name: u-boot-orangepi-5 | ||
variant: scratch | ||
shell: /toolchain/bin/bash | ||
dependencies: | ||
- stage: base | ||
- stage: arm-trusted-firmware-rk3588 | ||
- stage: rkbin-rk3588 | ||
steps: | ||
- sources: | ||
- url: https://ftp.denx.de/pub/u-boot/u-boot-{{ .uboot_version }}.tar.bz2 | ||
destination: u-boot.tar.bz2 | ||
sha256: "{{ .uboot_sha256 }}" | ||
sha512: "{{ .uboot_sha512 }}" | ||
env: | ||
SOURCE_DATE_EPOCH: "{{ .BUILD_ARG_SOURCE_DATE_EPOCH }}" | ||
prepare: | ||
# orangepi-5-rk3588 | ||
- | | ||
mkdir -p /usr/bin \ | ||
&& ln -sf /toolchain/bin/env /usr/bin/env \ | ||
&& ln -sf /toolchain/bin/python3 /toolchain/bin/python | ||
pip3 install pyelftools setuptools | ||
tar xf u-boot.tar.bz2 --strip-components=1 | ||
patch -p1 < /pkg/patches/uboot-byteorder.patch | ||
- | | ||
make orangepi-5-rk3588s_defconfig | ||
build: | ||
- | | ||
make -j $(nproc) \ | ||
HOSTLDLIBS_mkimage="-lssl -lcrypto" \ | ||
BL31=/libs/arm-trusted-firmware/rk3588/bl31.elf \ | ||
ROCKCHIP_TPL=/libs/rkbin/rk3588_ddr_1560MHz_v1.21.bin \ | ||
CONFIG_USB_HOST_ETHER=y \ | ||
CONFIG_USB_ETHER_RTL8152=y | ||
install: | ||
- | | ||
mkdir -p /rootfs/artifacts/arm64/u-boot/orangepi-5 | ||
cp u-boot-rockchip.bin /rootfs/artifacts/arm64/u-boot/orangepi-5 | ||
finalize: | ||
- from: /rootfs | ||
to: /rootfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# References: | ||
# Rockchip | ||
# - https://github.com/rockchip-linux/rkbin/tree/master/bin/rk35 | ||
name: rkbin-rk3588 | ||
variant: scratch | ||
shell: /toolchain/bin/bash | ||
dependencies: | ||
- stage: base | ||
steps: | ||
- sources: | ||
- url: https://github.com/rockchip-linux/rkbin/archive/{{ .rkbin_ref }}.tar.gz | ||
destination: rkbin.tar.gz | ||
sha256: "{{ .rkbin_sha256 }}" | ||
sha512: "{{ .rkbin_sha512 }}" | ||
env: | ||
SOURCE_DATE_EPOCH: {{.BUILD_ARG_SOURCE_DATE_EPOCH}} | ||
prepare: | ||
- | | ||
tar xf rkbin.tar.gz --strip-components=1 | ||
build: | ||
install: | ||
- | | ||
mkdir -p /rootfs/rkbin | ||
cp bin/rk35/rk3588_ddr_lp4_2112MHz_* /rootfs/rkbin/ | ||
finalize: | ||
- from: /rootfs | ||
to: /libs |
Oops, something went wrong.