@@ -160,6 +160,12 @@ def fdt_json(self) -> Optional[dict[str, Any]]:
160160 return literal_eval (self .fdt .to_json ().replace ("null" , "None" ))
161161 return None
162162
163+ @property
164+ def board (self ) -> Optional [str ]:
165+ if self .fdt_json is not None :
166+ return self .fdt_json ["model" ][1 ]
167+ return None
168+
163169 def _fdclose (self , fd : BinaryIO ) -> None :
164170 self ._open_files -= 1
165171 if self ._closefd and not self ._open_files :
@@ -294,6 +300,22 @@ def get_kernel_config(self) -> Optional[bytes]:
294300 return gzip .decompress (match .group (1 ))
295301 return None
296302
303+ def get_vendor (self ) -> Optional [str ]:
304+ map_ = {
305+ "novatek" : "Novatek" ,
306+ "sstar" : "MStar/SigmaStar" ,
307+ "hisilicon" : "HiSilicon" ,
308+ }
309+ if self .fdt_json is not None :
310+ key = self .fdt_json ["compatible" ][1 ].split (',' )[0 ]
311+ return map_ .get (key .lower (), key )
312+ with self .open (self ["uboot" ]) as f :
313+ if re .match (b"GM[0-9]{4}" , f .read (6 )):
314+ return "Grain Media"
315+ if re .search (b"HISILICON LOGO MAGIC" , self .uboot_section ) is not None :
316+ return "HiSilicon"
317+ return None
318+
297319 def get_fs_info (self ) -> list [dict [str , str ]]:
298320 result = []
299321 for section in self ._fs_sections :
@@ -332,6 +354,8 @@ async def get_info(self) -> dict[str, Any]:
332354 "uboot_compiler" : compiler ,
333355 "uboot_linker" : linker ,
334356 "linux_banner" : self .get_linux_banner (),
357+ "board" : self .board or "Unknown" ,
358+ "board_vendor" : self .get_vendor () or "Unknown" ,
335359 "filesystems" : self .get_fs_info (),
336360 "sha256" : ha
337361 }
0 commit comments