libdebian-installer
Functions
Subarchitecture detection

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".

Referenced by di_system_subarch_analyze_guess().

155 {
156  char entry[256];
157  int i;
158  int ret;
159 
160  entry[0] = '\0';
161 
162  ret = read_dt_model(entry, sizeof(entry));
163  if (ret)
164  ret = read_cpuinfo(entry, sizeof(entry));
165  if (ret)
166  return "unknown";
167 
168  for (i = 0; map_hardware[i].entry; i++)
169  {
170  if (!strncasecmp(map_hardware[i].entry, entry,
171  strlen(map_hardware[i].entry)))
172  {
173  return( map_hardware[i].ret );
174  }
175  }
176 
177  return "unknown";
178 }
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().

181 {
182  struct utsname sysinfo;
183  size_t uname_release_len, i;
184 
185  /* Attempt to determine subarch based on kernel release version */
186  uname(&sysinfo);
187  uname_release_len = strlen(sysinfo.release);
188 
189  for (i = 0; supported_generic_subarches[i] != NULL; i++)
190  {
191  size_t subarch_len = strlen (supported_generic_subarches[i]);
192  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
193  supported_generic_subarches[i],
194  subarch_len))
195  {
196  return supported_generic_subarches[i];
197  }
198  }
199 
200  /* If we get here, try falling back on the normal detection method */
201  return di_system_subarch_analyze();
202 }
const char * di_system_subarch_analyze(void)
Definition: subarch-arm-linux.c:154