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

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

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

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