rewrite the lunabuild toolchain with enhanced feature
[lunaix-os.git] / lunaix-os / hal / LConfig
index 63598dbd4dcca3795990be6d88f04091303b6a7b..26f53b8815862704ee5aa5b504173128f0af331d 100644 (file)
@@ -1,9 +1,30 @@
-include("char")
-include("bus")
-include("ahci")
+from . import char, bus, ahci
 
-@Collection("Devices & Peripherials")
+@"Devices & Peripherials"
 def hal():
     """ Lunaix hardware asbtraction layer """
 
-    pass
\ No newline at end of file
+    @"Devicetree for hardware discovery"
+    def use_devicetree() -> bool:
+        """
+            Decide whether to use Devicetree for platform
+            resource topology sensing.
+
+            On some architecture, Lunaix will fallback to use
+            devicetree when ran out of options. For others, such
+            as those designed with embedded support in mind, 
+            devicetree might be mandatory and perhaps the only
+            way.
+        """
+
+        return arch.val not in ["x86_64", "i386"]
+
+    @"Maximum size of device tree blob (in KiB)"
+    @readonly
+    def dtb_maxsize() -> int:
+        """
+            Maximum size for a firmware provided device tree blob
+        """
+        require(use_devicetree)
+
+        return 256
\ No newline at end of file