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

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

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