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  entry[0] = '\0';
181 
182  ret = read_dt_model(entry, sizeof(entry));
183  if (ret)
184  ret = read_cpuinfo(entry, sizeof(entry));
185  if (ret)
186  return "generic";
187 
188  for (i = 0; map_hardware[i].entry; i++)
189  {
190  if (!strncasecmp(map_hardware[i].entry, entry,
191  strlen(map_hardware[i].entry)))
192  {
193  return( map_hardware[i].ret );
194  }
195  }
196 
197  return "generic";
198 }

◆ 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().

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