libdebian-installer
Functions
Di_system_subarch

Functions

const char * di_system_subarch_analyze (void)
 
const char * di_system_subarch_analyze_guess (void)
 

Detailed Description

Function Documentation

◆ di_system_subarch_analyze()

const char* di_system_subarch_analyze ( void  )

Returns a string describing the current subarchitecture, e.g. "powermac_newworld".

References di_system_is_efi().

Referenced by di_system_subarch_analyze_guess().

175 {
176  char entry[256];
177  int i;
178  int ret;
179 
180  /* If we detect EFI firmware, bail out early here */
181  if (di_system_is_efi())
182  return "efi";
183 
184  entry[0] = '\0';
185 
186  ret = read_dt_model(entry, sizeof(entry));
187  if (ret)
188  ret = read_cpuinfo(entry, sizeof(entry));
189  if (ret)
190  return "generic";
191 
192  for (i = 0; map_hardware[i].entry; i++)
193  {
194  if (!strncasecmp(map_hardware[i].entry, entry,
195  strlen(map_hardware[i].entry)))
196  {
197  return( map_hardware[i].ret );
198  }
199  }
200 
201  return "generic";
202 }
int di_system_is_efi(void)
Definition: efi.c:27

◆ di_system_subarch_analyze_guess()

const char* di_system_subarch_analyze_guess ( void  )

Return a string with a best-guess of the current subarchitecture

Only present on armel currently, and is a stub on all other architectures

References di_system_is_efi(), and di_system_subarch_analyze().

205 {
206  struct utsname sysinfo;
207  size_t uname_release_len, i;
208 
209  /* If we detect EFI firmware, bail out early here */
210  if (di_system_is_efi())
211  return "efi";
212 
213  /* Attempt to determine subarch based on kernel release version */
214  uname(&sysinfo);
215  uname_release_len = strlen(sysinfo.release);
216 
217  for (i = 0; supported_generic_subarches[i] != NULL; i++)
218  {
219  size_t subarch_len = strlen (supported_generic_subarches[i]);
220  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
221  supported_generic_subarches[i],
222  subarch_len))
223  {
224  return supported_generic_subarches[i];
225  }
226  }
227 
228  /* If we get here, try falling back on the normal detection method */
229  return di_system_subarch_analyze();
230 }
const char * di_system_subarch_analyze(void)
Definition: subarch-arm-linux.c:174
int di_system_is_efi(void)
Definition: efi.c:27