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

166 {
167  char entry[256];
168  int i;
169  int ret;
170 
171  entry[0] = '\0';
172 
173  ret = read_dt_model(entry, sizeof(entry));
174  if (ret)
175  ret = read_cpuinfo(entry, sizeof(entry));
176  if (ret)
177  return "generic";
178 
179  for (i = 0; map_hardware[i].entry; i++)
180  {
181  if (!strncasecmp(map_hardware[i].entry, entry,
182  strlen(map_hardware[i].entry)))
183  {
184  return( map_hardware[i].ret );
185  }
186  }
187 
188  return "generic";
189 }
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_subarch_analyze().

192 {
193  struct utsname sysinfo;
194  size_t uname_release_len, i;
195 
196  /* Attempt to determine subarch based on kernel release version */
197  uname(&sysinfo);
198  uname_release_len = strlen(sysinfo.release);
199 
200  for (i = 0; supported_generic_subarches[i] != NULL; i++)
201  {
202  size_t subarch_len = strlen (supported_generic_subarches[i]);
203  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
204  supported_generic_subarches[i],
205  subarch_len))
206  {
207  return supported_generic_subarches[i];
208  }
209  }
210 
211  /* If we get here, try falling back on the normal detection method */
212  return di_system_subarch_analyze();
213 }
const char * di_system_subarch_analyze(void)
Definition: subarch-arm-linux.c:165