{"id":22753606,"url":"https://github.com/starryinternet/dt-fragment-loader","last_synced_at":"2025-04-14T15:34:05.504Z","repository":{"id":53871005,"uuid":"521758815","full_name":"StarryInternet/dt-fragment-loader","owner":"StarryInternet","description":"A Linux Kernel Module for Advanced Device Tree Operations","archived":false,"fork":false,"pushed_at":"2022-09-27T17:25:56.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T04:25:14.057Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StarryInternet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-05T19:46:14.000Z","updated_at":"2023-03-23T19:11:04.000Z","dependencies_parsed_at":"2023-01-18T19:24:14.169Z","dependency_job_id":null,"html_url":"https://github.com/StarryInternet/dt-fragment-loader","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarryInternet%2Fdt-fragment-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarryInternet%2Fdt-fragment-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarryInternet%2Fdt-fragment-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarryInternet%2Fdt-fragment-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StarryInternet","download_url":"https://codeload.github.com/StarryInternet/dt-fragment-loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248906404,"owners_count":21181173,"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","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":"2024-12-11T06:11:54.269Z","updated_at":"2025-04-14T15:34:05.476Z","avatar_url":"https://github.com/StarryInternet.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DT Fragment Loader\n\nA Linux Kernel Module for Advanced Device Tree Operations\n\n# Applying Fragments\n\nFragments are applied based on the \"active fragments\" that are passed into the\nmodule during init.\n\n## Active Fragments\n\nThe \"active fragments\" string should be a comma separated list of \"fragment\nids\" to activate. These can either match `location` and `compat` properties of\na fragment with the format `l%d_c%d`; or just a `param` string. For example:\n`\"l1_c3,l2_c4,custom_param\"`.\n\nThe **kernel commandline** can provide a string as a module parameter,\n`active_fragments=\"\"` or `dt_fragment_loader.active_fragments=\"\"`.\n\nThe **device-tree** can provide an active fragments string as a property at\n`/dt-fragments/active-fragments`.\n\nWe also detect **duplicate fragment ids** while parsing active fragments.\nA \"duplicate fragment id\" is defined as a fragment id that has either the\nsame *location* or *param* value as another fragment id.\n\nIn event of \"duplicate\" fragment ids. The applied fragment id is chosen via\nthe following precendence:\n\n1. The *first* fragment id provided by the *kernel command line*\n2. The *first* fragment id provided by the *device-tree*\n\nThus, this allows the device tree to provide a \"default\" for a location which\nmay be overridden by the kernel command line.\n\n## Fragment Application Timing\n\nOnce this module is loaded, fragments are immediately applied.\n\nFragments are applied in the order that they are numbered in the\n`dt-fragments` node. e.g. `fragment@0` is applied before `fragment@1`.\n\nOperations are also applied in the same order via their numbering within their\nfragment. e.g. `override@0` is applied before `override@1`.\n\nOperations within fragments are continuously applied as they are parsed. Which\nmeans that the init of drivers for moved nodes may occur before fragment-loader\nis complete.\n\n\n# Writing Fragments\n\nFragment nodes are to be added to `/dt-fragments`.\n\n## Fragment Nodes\n\nFragments define a set of device tree modifications, and the \"fragment id\"\nthat activates them.\n\n**Fragment node Property List**\n- *[node reg]* - The reg value is used to define the order of which fragments\n  should be applied.\n- *[child nodes]* - All children of a fragment should be **operation nodes**.\n- `location` - An arbitrary enumeration of a physical hardware location in a\n  system.\n- `compat` - An arbitrary enumeration of compatible hardware that could be\n  present at a physical location.\n- `param` - An arbitrary string for \"fragment id\" params that does **not**\n  rely on `location` or `compat` enumerations.\n\n## Operation Nodes\n\nOperation nodes are the child nodes under a fragment that define the\ndevice-tree modifications to perform.\n\nAll operations are described in detail under sub-headings below.\n\n**Generic Operation Node Property List**\n- *[node name]* - The name of the node defines the type of operation to apply.\n- *[node reg]* - The reg value is used to define the order of which operations\n  should be applied while applying a fragment.\n\n### The `override` Operation Node\n\nThe `override` operation provides the ability to copy and overwrite device-tree\nproperties, and to **move** new child nodes.\n\nChild nodes are moved to allow them to keep the same phandle without creating\nduplicate phandles. This means they are removed from the out-of-tree fragment\nwhen applied.\n\nFurther, child nodes can **not** overwrite an existing node. Attempting to do\nso will result in an error from fragment-loader. Modifying existing nodes\nshould be done via modifying properties with seperate `override` operations.\n\n**`Override` Node Property List**\n- *[node name]* - Must be `override@N`\n- `target` - A phandle reference of the in tree device-tree node to modify.\n- `_overlay_` (child node) - The out-of-tree properties/nodes that are to be\n  copied/moved into the \"target\" respectively.\n\n## Example `/dt-fragment` Node\n\n```C\n/{\n  dt-fragments {\n    status = \"okay\";\n    active-fragments = \"l0_c4\";\n\n    fragment-component-name@0 {\n      location = \u003c0\u003e;\n      compat = \u003c4\u003e;\n      param = \"a_second_custom_enable_str\";\n\n      override@0 {\n        target = \u003c\u0026target_node\u003e;\n\n        _overlay_ {\n          status = \"okay\";\n          arbitrary-prop = \u003c23\u003e;\n          arbitrary-child-node@0 {\n            status = \"disabled\";\n          };\n        };\n      };\n    };\n  };\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstarryinternet%2Fdt-fragment-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstarryinternet%2Fdt-fragment-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstarryinternet%2Fdt-fragment-loader/lists"}