basic_info.rs 693 B

12345678910111213141516171819202122
  1. static MY_FDT: &[u8] = include_bytes!("../test.dtb");
  2. fn main() {
  3. let fdt = fdt::Fdt::new(MY_FDT).unwrap();
  4. println!("This is a devicetree representation of a {}", fdt.root().model());
  5. println!("...which is compatible with at least: {}", fdt.root().compatible().first());
  6. println!(
  7. "...and has at least one memory location at: {:#X}\n",
  8. fdt.memory().regions().next().unwrap().starting_address as usize
  9. );
  10. let chosen = fdt.chosen();
  11. if let Some(bootargs) = chosen.bootargs() {
  12. println!("The bootargs are: {:?}", bootargs);
  13. }
  14. if let Some(stdout) = chosen.stdout() {
  15. println!("It would write to: {}", stdout.name);
  16. }
  17. }