fdt_select.py 588 B

1234567891011121314151617181920212223
  1. #!/usr/bin/python
  2. #
  3. # Copyright (C) 2016 Google, Inc
  4. # Written by Simon Glass <sjg@chromium.org>
  5. #
  6. # SPDX-License-Identifier: GPL-2.0+
  7. #
  8. # Bring in either the normal fdt library (which relies on libfdt) or the
  9. # fallback one (which uses fdtget and is slower). Both provide the same
  10. # interface for this file to use.
  11. try:
  12. import fdt
  13. have_libfdt = True
  14. except ImportError:
  15. have_libfdt = False
  16. import fdt_fallback as fdt
  17. def FdtScan(fname):
  18. """Returns a new Fdt object from the implementation we are using"""
  19. dtb = fdt.Fdt(fname)
  20. dtb.Scan()
  21. return dtb