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

147 {
148  char entry[256];
149  int i;
150  int ret;
151 
152  entry[0] = '\0';
153 
154  ret = read_dt_model(entry, sizeof(entry));
155  if (ret)
156  ret = read_cpuinfo(entry, sizeof(entry));
157  if (ret)
158  return "unknown";
159 
160  for (i = 0; map_hardware[i].entry; i++)
161  {
162  if (!strncasecmp(map_hardware[i].entry, entry,
163  strlen(map_hardware[i].entry)))
164  {
165  return( map_hardware[i].ret );
166  }
167  }
168 
169  return "unknown";
170 }
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().

173 {
174  struct utsname sysinfo;
175  size_t uname_release_len, i;
176 
177  /* Attempt to determine subarch based on kernel release version */
178  uname(&sysinfo);
179  uname_release_len = strlen(sysinfo.release);
180 
181  for (i = 0; supported_generic_subarches[i] != NULL; i++)
182  {
183  size_t subarch_len = strlen (supported_generic_subarches[i]);
184  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
185  supported_generic_subarches[i],
186  subarch_len))
187  {
188  return supported_generic_subarches[i];
189  }
190  }
191 
192  /* If we get here, try falling back on the normal detection method */
193  return di_system_subarch_analyze();
194 }