rewrite the lunabuild toolchain with enhanced feature
[lunaix-os.git] / lunaix-os / hal / LConfig
1 from . import char, bus, ahci
2
3 @"Devices & Peripherials"
4 def hal():
5     """ Lunaix hardware asbtraction layer """
6
7     @"Devicetree for hardware discovery"
8     def use_devicetree() -> bool:
9         """
10             Decide whether to use Devicetree for platform
11             resource topology sensing.
12
13             On some architecture, Lunaix will fallback to use
14             devicetree when ran out of options. For others, such
15             as those designed with embedded support in mind, 
16             devicetree might be mandatory and perhaps the only
17             way.
18         """
19
20         return arch.val not in ["x86_64", "i386"]
21
22     @"Maximum size of device tree blob (in KiB)"
23     @readonly
24     def dtb_maxsize() -> int:
25         """
26             Maximum size for a firmware provided device tree blob
27         """
28         require(use_devicetree)
29
30         return 256