diff options
| author | Mark Hatle <mark.hatle@windriver.com> | 2017-09-05 14:02:01 -0500 |
|---|---|---|
| committer | Joe MacDonald <joe_macdonald@mentor.com> | 2017-09-12 10:55:08 -0400 |
| commit | e889c678a6cff071cab5d6d68d6bd3e6877b7315 (patch) | |
| tree | 1a87f60e1d3a560ced26dbf38a8d3c45266618be /meta-networking | |
| parent | 58db2c981b8cea7f0b4a47a2cd4bb3251cc33e37 (diff) | |
| download | meta-openembedded-e889c678a6cff071cab5d6d68d6bd3e6877b7315.tar.gz | |
openipmi: Move to meta-networking requires net-snmp
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking')
10 files changed, 1433 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/openipmi/files/0001-lanserv-Rename-struct-parameter-printf-for-namespace.patch b/meta-networking/recipes-support/openipmi/files/0001-lanserv-Rename-struct-parameter-printf-for-namespace.patch new file mode 100644 index 0000000000..25057fbce5 --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/0001-lanserv-Rename-struct-parameter-printf-for-namespace.patch | |||
| @@ -0,0 +1,618 @@ | |||
| 1 | From 8b51a6bf5a4829d8add535a098c0c06a049a9958 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 26 Aug 2017 22:50:57 -0700 | ||
| 4 | Subject: [PATCH] lanserv: Rename struct parameter printf for namespace | ||
| 5 | collision | ||
| 6 | |||
| 7 | This comes to fore when we use hardening flags where printf | ||
| 8 | is treated as macro and gets replaced with printf_chk | ||
| 9 | |||
| 10 | Fixes errors like | ||
| 11 | |||
| 12 | error: no member named '__printf_chk' in 'struct emu_out_s' | ||
| 13 | |||
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 15 | --- | ||
| 16 | lanserv/OpenIPMI/serv.h | 2 +- | ||
| 17 | lanserv/emu_cmd.c | 132 ++++++++++++++++++++++++------------------------ | ||
| 18 | lanserv/ipmi_sim.c | 10 ++-- | ||
| 19 | 3 files changed, 72 insertions(+), 72 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/lanserv/OpenIPMI/serv.h b/lanserv/OpenIPMI/serv.h | ||
| 22 | index d12d63a..8555c85 100644 | ||
| 23 | --- a/lanserv/OpenIPMI/serv.h | ||
| 24 | +++ b/lanserv/OpenIPMI/serv.h | ||
| 25 | @@ -522,7 +522,7 @@ uint8_t ipmb_checksum(uint8_t *data, int size, uint8_t start); | ||
| 26 | typedef struct emu_data_s emu_data_t; | ||
| 27 | typedef struct emu_out_s | ||
| 28 | { | ||
| 29 | - void (*printf)(struct emu_out_s *out, char *format, ...); | ||
| 30 | + void (*eprintf)(struct emu_out_s *out, char *format, ...); | ||
| 31 | void *data; | ||
| 32 | } emu_out_t; | ||
| 33 | |||
| 34 | diff --git a/lanserv/emu_cmd.c b/lanserv/emu_cmd.c | ||
| 35 | index ca44032..54b6f7b 100644 | ||
| 36 | --- a/lanserv/emu_cmd.c | ||
| 37 | +++ b/lanserv/emu_cmd.c | ||
| 38 | @@ -76,7 +76,7 @@ emu_get_uchar(emu_out_t *out, char **toks, unsigned char *val, char *errstr, | ||
| 39 | if (empty_ok) | ||
| 40 | return ENOSPC; | ||
| 41 | if (errstr) | ||
| 42 | - out->printf(out, "**No %s given\n", errstr); | ||
| 43 | + out->eprintf(out, "**No %s given\n", errstr); | ||
| 44 | return EINVAL; | ||
| 45 | } | ||
| 46 | if (str[0] == '\'') { | ||
| 47 | @@ -86,7 +86,7 @@ emu_get_uchar(emu_out_t *out, char **toks, unsigned char *val, char *errstr, | ||
| 48 | *val = strtoul(str, &tmpstr, 0); | ||
| 49 | if (*tmpstr != '\0') { | ||
| 50 | if (errstr) | ||
| 51 | - out->printf(out, "**Invalid %s given\n", errstr); | ||
| 52 | + out->eprintf(out, "**Invalid %s given\n", errstr); | ||
| 53 | return EINVAL; | ||
| 54 | } | ||
| 55 | |||
| 56 | @@ -108,7 +108,7 @@ emu_get_uchar_with_vals(emu_out_t *out, char **toks, | ||
| 57 | if (empty_ok) | ||
| 58 | return ENOSPC; | ||
| 59 | if (errstr) | ||
| 60 | - out->printf(out, "**No %s given\n", errstr); | ||
| 61 | + out->eprintf(out, "**No %s given\n", errstr); | ||
| 62 | return EINVAL; | ||
| 63 | } | ||
| 64 | if (str[0] == '\'') { | ||
| 65 | @@ -131,7 +131,7 @@ emu_get_uchar_with_vals(emu_out_t *out, char **toks, | ||
| 66 | *val = strtoul(str, &tmpstr, 0); | ||
| 67 | if (*tmpstr != '\0') { | ||
| 68 | if (errstr) | ||
| 69 | - out->printf(out, "**Invalid %s given\n", errstr); | ||
| 70 | + out->eprintf(out, "**Invalid %s given\n", errstr); | ||
| 71 | return EINVAL; | ||
| 72 | } | ||
| 73 | out: | ||
| 74 | @@ -150,12 +150,12 @@ emu_get_bitmask(emu_out_t *out, char **toks, uint16_t *val, char *errstr, | ||
| 75 | if (empty_ok) | ||
| 76 | return ENOSPC; | ||
| 77 | if (errstr) | ||
| 78 | - out->printf(out, "**No %s given\n", errstr); | ||
| 79 | + out->eprintf(out, "**No %s given\n", errstr); | ||
| 80 | return EINVAL; | ||
| 81 | } | ||
| 82 | if (strlen(str) != size) { | ||
| 83 | if (errstr) | ||
| 84 | - out->printf(out, "**invalid number of bits in %s\n", errstr); | ||
| 85 | + out->eprintf(out, "**invalid number of bits in %s\n", errstr); | ||
| 86 | return EINVAL; | ||
| 87 | } | ||
| 88 | *val = 0; | ||
| 89 | @@ -166,7 +166,7 @@ emu_get_bitmask(emu_out_t *out, char **toks, uint16_t *val, char *errstr, | ||
| 90 | *val |= 1 << i; | ||
| 91 | } else { | ||
| 92 | if (errstr) | ||
| 93 | - out->printf(out, "**Invalid bit value '%c' in %s\n", str[j], | ||
| 94 | + out->eprintf(out, "**Invalid bit value '%c' in %s\n", str[j], | ||
| 95 | errstr); | ||
| 96 | return EINVAL; | ||
| 97 | } | ||
| 98 | @@ -184,13 +184,13 @@ emu_get_uint(emu_out_t *out, char **toks, unsigned int *val, char *errstr) | ||
| 99 | str = mystrtok(NULL, " \t\n", toks); | ||
| 100 | if (!str) { | ||
| 101 | if (errstr) | ||
| 102 | - out->printf(out, "**No %s given\n", errstr); | ||
| 103 | + out->eprintf(out, "**No %s given\n", errstr); | ||
| 104 | return EINVAL; | ||
| 105 | } | ||
| 106 | *val = strtoul(str, &tmpstr, 0); | ||
| 107 | if (*tmpstr != '\0') { | ||
| 108 | if (errstr) | ||
| 109 | - out->printf(out, "**Invalid %s given\n", errstr); | ||
| 110 | + out->eprintf(out, "**Invalid %s given\n", errstr); | ||
| 111 | return EINVAL; | ||
| 112 | } | ||
| 113 | |||
| 114 | @@ -206,7 +206,7 @@ emu_get_bytes(emu_out_t *out, char **tokptr, unsigned char *data, char *errstr, | ||
| 115 | |||
| 116 | if (!tok) { | ||
| 117 | if (errstr) | ||
| 118 | - out->printf(out, "**No %s given\n", errstr); | ||
| 119 | + out->eprintf(out, "**No %s given\n", errstr); | ||
| 120 | return EINVAL; | ||
| 121 | } | ||
| 122 | if (*tok == '"') { | ||
| 123 | @@ -215,7 +215,7 @@ emu_get_bytes(emu_out_t *out, char **tokptr, unsigned char *data, char *errstr, | ||
| 124 | tok++; | ||
| 125 | end = strlen(tok) - 1; | ||
| 126 | if (tok[end] != '"') { | ||
| 127 | - out->printf(out, "**ASCII %s doesn't end in '\"'", errstr); | ||
| 128 | + out->eprintf(out, "**ASCII %s doesn't end in '\"'", errstr); | ||
| 129 | return EINVAL; | ||
| 130 | } | ||
| 131 | if (end > (len - 1)) | ||
| 132 | @@ -228,7 +228,7 @@ emu_get_bytes(emu_out_t *out, char **tokptr, unsigned char *data, char *errstr, | ||
| 133 | char c[3]; | ||
| 134 | /* HEX pw */ | ||
| 135 | if (strlen(tok) != 32) { | ||
| 136 | - out->printf(out, "**HEX %s not 32 HEX characters long", errstr); | ||
| 137 | + out->eprintf(out, "**HEX %s not 32 HEX characters long", errstr); | ||
| 138 | return EINVAL; | ||
| 139 | } | ||
| 140 | c[2] = '\0'; | ||
| 141 | @@ -239,7 +239,7 @@ emu_get_bytes(emu_out_t *out, char **tokptr, unsigned char *data, char *errstr, | ||
| 142 | tok++; | ||
| 143 | data[i] = strtoul(c, &end, 16); | ||
| 144 | if (*end != '\0') { | ||
| 145 | - out->printf(out, "**Invalid HEX character in %s", errstr); | ||
| 146 | + out->eprintf(out, "**Invalid HEX character in %s", errstr); | ||
| 147 | return -1; | ||
| 148 | } | ||
| 149 | } | ||
| 150 | @@ -263,12 +263,12 @@ read_command_file(emu_out_t *out, emu_data_t *emu, const char *command_file) | ||
| 151 | |||
| 152 | buffer = malloc(INPUT_BUFFER_SIZE); | ||
| 153 | if (!buffer) { | ||
| 154 | - out->printf(out, "Could not allocate buffer memory\n"); | ||
| 155 | + out->eprintf(out, "Could not allocate buffer memory\n"); | ||
| 156 | rv = ENOMEM; | ||
| 157 | goto out; | ||
| 158 | } | ||
| 159 | while (fgets(buffer+pos, INPUT_BUFFER_SIZE-pos, f)) { | ||
| 160 | - out->printf(out, "%s", buffer+pos); | ||
| 161 | + out->eprintf(out, "%s", buffer+pos); | ||
| 162 | if (buffer[pos] == '#') | ||
| 163 | continue; | ||
| 164 | pos = strlen(buffer); | ||
| 165 | @@ -318,7 +318,7 @@ sel_enable(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 166 | |||
| 167 | rv = ipmi_mc_enable_sel(mc, max_records, flags); | ||
| 168 | if (rv) | ||
| 169 | - out->printf(out, "**Unable to enable sel, error 0x%x\n", rv); | ||
| 170 | + out->eprintf(out, "**Unable to enable sel, error 0x%x\n", rv); | ||
| 171 | return rv; | ||
| 172 | } | ||
| 173 | |||
| 174 | @@ -343,9 +343,9 @@ sel_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 175 | |||
| 176 | rv = ipmi_mc_add_to_sel(mc, record_type, data, &r); | ||
| 177 | if (rv) | ||
| 178 | - out->printf(out, "**Unable to add to sel, error 0x%x\n", rv); | ||
| 179 | + out->eprintf(out, "**Unable to add to sel, error 0x%x\n", rv); | ||
| 180 | else | ||
| 181 | - out->printf(out, "Added record %d\n", r); | ||
| 182 | + out->eprintf(out, "Added record %d\n", r); | ||
| 183 | return rv; | ||
| 184 | } | ||
| 185 | |||
| 186 | @@ -361,14 +361,14 @@ main_sdr_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 187 | if (rv == ENOSPC) | ||
| 188 | break; | ||
| 189 | if (rv) { | ||
| 190 | - out->printf(out, "**Error 0x%x in data byte %d\n", rv, i); | ||
| 191 | + out->eprintf(out, "**Error 0x%x in data byte %d\n", rv, i); | ||
| 192 | return rv; | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | rv = ipmi_mc_add_main_sdr(mc, data, i); | ||
| 197 | if (rv) | ||
| 198 | - out->printf(out, "**Unable to add to sdr, error 0x%x\n", rv); | ||
| 199 | + out->eprintf(out, "**Unable to add to sdr, error 0x%x\n", rv); | ||
| 200 | return rv; | ||
| 201 | } | ||
| 202 | |||
| 203 | @@ -389,14 +389,14 @@ device_sdr_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 204 | if (rv == ENOSPC) | ||
| 205 | break; | ||
| 206 | if (rv) { | ||
| 207 | - out->printf(out, "**Error 0x%x in data byte %d\n", rv, i); | ||
| 208 | + out->eprintf(out, "**Error 0x%x in data byte %d\n", rv, i); | ||
| 209 | return rv; | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 213 | rv = ipmi_mc_add_device_sdr(mc, lun, data, i); | ||
| 214 | if (rv) | ||
| 215 | - out->printf(out, "**Unable to add to sdr, error 0x%x\n", rv); | ||
| 216 | + out->eprintf(out, "**Unable to add to sdr, error 0x%x\n", rv); | ||
| 217 | return rv; | ||
| 218 | } | ||
| 219 | |||
| 220 | @@ -439,7 +439,7 @@ sensor_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 221 | while (tok) { | ||
| 222 | if (strcmp(tok, "poll") == 0) { | ||
| 223 | if (handler) { | ||
| 224 | - out->printf(out, "**poll given twice in sensor\n", tok); | ||
| 225 | + out->eprintf(out, "**poll given twice in sensor\n", tok); | ||
| 226 | return -1; | ||
| 227 | } | ||
| 228 | |||
| 229 | @@ -449,27 +449,27 @@ sensor_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 230 | |||
| 231 | tok = mystrtok(NULL, " \t\n", toks); | ||
| 232 | if (!tok) { | ||
| 233 | - out->printf(out, "**No polled sensor handler given\n", tok); | ||
| 234 | + out->eprintf(out, "**No polled sensor handler given\n", tok); | ||
| 235 | return -1; | ||
| 236 | } | ||
| 237 | |||
| 238 | handler = ipmi_sensor_find_handler(tok); | ||
| 239 | if (!handler) { | ||
| 240 | - out->printf(out, "**Invalid sensor handler: %s\n", tok); | ||
| 241 | + out->eprintf(out, "**Invalid sensor handler: %s\n", tok); | ||
| 242 | return -1; | ||
| 243 | } | ||
| 244 | |||
| 245 | rv = handler->init(mc, lun, num, toks, handler->cb_data, &rcb_data, | ||
| 246 | &errstr); | ||
| 247 | if (rv) { | ||
| 248 | - out->printf(out, "**Error initializing sensor handler: %s\n", | ||
| 249 | + out->eprintf(out, "**Error initializing sensor handler: %s\n", | ||
| 250 | errstr); | ||
| 251 | return rv; | ||
| 252 | } | ||
| 253 | } else if (strcmp(tok, "event-only") == 0) { | ||
| 254 | event_only = 1; | ||
| 255 | } else { | ||
| 256 | - out->printf(out, "**Unknown sensor option: %s\n", tok); | ||
| 257 | + out->eprintf(out, "**Unknown sensor option: %s\n", tok); | ||
| 258 | return -1; | ||
| 259 | } | ||
| 260 | |||
| 261 | @@ -477,7 +477,7 @@ sensor_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 262 | } | ||
| 263 | |||
| 264 | if (handler && event_only) { | ||
| 265 | - out->printf(out, "**An event-only sensor cannot be polled\n"); | ||
| 266 | + out->eprintf(out, "**An event-only sensor cannot be polled\n"); | ||
| 267 | return -1; | ||
| 268 | } | ||
| 269 | |||
| 270 | @@ -488,7 +488,7 @@ sensor_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 271 | if (!rv && handler->postinit) { | ||
| 272 | rv = handler->postinit(rcb_data, &errstr); | ||
| 273 | if (rv) { | ||
| 274 | - out->printf(out, "**Error in sensor handler postinit: %s\n", | ||
| 275 | + out->eprintf(out, "**Error in sensor handler postinit: %s\n", | ||
| 276 | errstr); | ||
| 277 | } | ||
| 278 | } | ||
| 279 | @@ -496,7 +496,7 @@ sensor_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 280 | rv = ipmi_mc_add_sensor(mc, lun, num, type, code, event_only); | ||
| 281 | } | ||
| 282 | if (rv) | ||
| 283 | - out->printf(out, "**Unable to add to sensor, error 0x%x\n", rv); | ||
| 284 | + out->eprintf(out, "**Unable to add to sensor, error 0x%x\n", rv); | ||
| 285 | return rv; | ||
| 286 | } | ||
| 287 | |||
| 288 | @@ -532,7 +532,7 @@ sensor_set_bit(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 289 | |||
| 290 | rv = ipmi_mc_sensor_set_bit(mc, lun, num, bit, value, gen_event); | ||
| 291 | if (rv) | ||
| 292 | - out->printf(out, "**Unable to set sensor bit, error 0x%x\n", rv); | ||
| 293 | + out->eprintf(out, "**Unable to set sensor bit, error 0x%x\n", rv); | ||
| 294 | return rv; | ||
| 295 | } | ||
| 296 | |||
| 297 | @@ -563,7 +563,7 @@ sensor_set_bit_clr_rest(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char ** | ||
| 298 | |||
| 299 | rv = ipmi_mc_sensor_set_bit_clr_rest(mc, lun, num, bit, gen_event); | ||
| 300 | if (rv) | ||
| 301 | - out->printf(out, "**Unable to set sensor bit, error 0x%x\n", rv); | ||
| 302 | + out->eprintf(out, "**Unable to set sensor bit, error 0x%x\n", rv); | ||
| 303 | return rv; | ||
| 304 | } | ||
| 305 | |||
| 306 | @@ -594,7 +594,7 @@ sensor_set_value(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 307 | |||
| 308 | rv = ipmi_mc_sensor_set_value(mc, lun, num, value, gen_event); | ||
| 309 | if (rv) | ||
| 310 | - out->printf(out, "**Unable to set sensor value, error 0x%x\n", rv); | ||
| 311 | + out->eprintf(out, "**Unable to set sensor value, error 0x%x\n", rv); | ||
| 312 | return rv; | ||
| 313 | } | ||
| 314 | |||
| 315 | @@ -637,7 +637,7 @@ sensor_set_hysteresis(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **to | ||
| 316 | rv = ipmi_mc_sensor_set_hysteresis(mc, lun, num, support, positive, | ||
| 317 | negative); | ||
| 318 | if (rv) | ||
| 319 | - out->printf(out, "**Unable to set sensor hysteresis, error 0x%x\n", rv); | ||
| 320 | + out->eprintf(out, "**Unable to set sensor hysteresis, error 0x%x\n", rv); | ||
| 321 | return rv; | ||
| 322 | } | ||
| 323 | |||
| 324 | @@ -682,7 +682,7 @@ sensor_set_threshold(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **tok | ||
| 325 | rv = ipmi_mc_sensor_set_threshold(mc, lun, num, support, | ||
| 326 | enabled, 1, thresholds); | ||
| 327 | if (rv) | ||
| 328 | - out->printf(out, "**Unable to set sensor thresholds, error 0x%x\n", rv); | ||
| 329 | + out->eprintf(out, "**Unable to set sensor thresholds, error 0x%x\n", rv); | ||
| 330 | return rv; | ||
| 331 | } | ||
| 332 | |||
| 333 | @@ -759,7 +759,7 @@ sensor_set_event_support(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char * | ||
| 334 | assert_support, deassert_support, | ||
| 335 | assert_enabled, deassert_enabled); | ||
| 336 | if (rv) | ||
| 337 | - out->printf(out, "**Unable to set sensor thresholds, error 0x%x\n", rv); | ||
| 338 | + out->eprintf(out, "**Unable to set sensor thresholds, error 0x%x\n", rv); | ||
| 339 | return rv; | ||
| 340 | } | ||
| 341 | |||
| 342 | @@ -819,7 +819,7 @@ mc_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 343 | else if (strcmp("persist_sdr", tok) == 0) | ||
| 344 | flags |= IPMI_MC_PERSIST_SDR; | ||
| 345 | else { | ||
| 346 | - out->printf(out, "**Invalid MC flag: %s\n", tok); | ||
| 347 | + out->eprintf(out, "**Invalid MC flag: %s\n", tok); | ||
| 348 | return -1; | ||
| 349 | } | ||
| 350 | } | ||
| 351 | @@ -833,7 +833,7 @@ mc_add(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 352 | device_revision, major_fw_rev, minor_fw_rev, | ||
| 353 | device_support, mfg_id, product_id, flags); | ||
| 354 | if (rv) | ||
| 355 | - out->printf(out, "**Unable to add the MC, error 0x%x\n", rv); | ||
| 356 | + out->eprintf(out, "**Unable to add the MC, error 0x%x\n", rv); | ||
| 357 | return rv; | ||
| 358 | } | ||
| 359 | |||
| 360 | @@ -890,7 +890,7 @@ mc_set_power(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 361 | |||
| 362 | rv = ipmi_mc_set_power(mc, power, gen_int); | ||
| 363 | if (rv) | ||
| 364 | - out->printf(out, "**Unable to set power, error 0x%x\n", rv); | ||
| 365 | + out->eprintf(out, "**Unable to set power, error 0x%x\n", rv); | ||
| 366 | return rv; | ||
| 367 | } | ||
| 368 | |||
| 369 | @@ -916,7 +916,7 @@ mc_add_fru_data(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 370 | |||
| 371 | tok = mystrtok(NULL, " \t\n", toks); | ||
| 372 | if (!tok) { | ||
| 373 | - out->printf(out, "**No FRU data type given"); | ||
| 374 | + out->eprintf(out, "**No FRU data type given"); | ||
| 375 | return -1; | ||
| 376 | } | ||
| 377 | if (strcmp(tok, "file") == 0) { | ||
| 378 | @@ -929,13 +929,13 @@ mc_add_fru_data(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 379 | |||
| 380 | rv = get_delim_str(toks, &frufn, &errstr); | ||
| 381 | if (rv) { | ||
| 382 | - out->printf(out, "**Error with FRU filename: %d", strerror(rv)); | ||
| 383 | + out->eprintf(out, "**Error with FRU filename: %d", strerror(rv)); | ||
| 384 | return rv; | ||
| 385 | } | ||
| 386 | rv = ipmi_mc_add_fru_file(mc, devid, length, file_offset, | ||
| 387 | (void *) frufn); | ||
| 388 | if (rv) | ||
| 389 | - out->printf(out, "**Unable to add FRU file, error 0x%x\n", rv); | ||
| 390 | + out->eprintf(out, "**Unable to add FRU file, error 0x%x\n", rv); | ||
| 391 | |||
| 392 | } else if (strcmp(tok, "data") == 0) { | ||
| 393 | for (i=0; i<length; i++) { | ||
| 394 | @@ -943,14 +943,14 @@ mc_add_fru_data(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 395 | if (rv == ENOSPC) | ||
| 396 | break; | ||
| 397 | if (rv) { | ||
| 398 | - out->printf(out, "**Error 0x%x in data byte %d\n", rv, i); | ||
| 399 | + out->eprintf(out, "**Error 0x%x in data byte %d\n", rv, i); | ||
| 400 | return rv; | ||
| 401 | } | ||
| 402 | } | ||
| 403 | |||
| 404 | rv = emu_get_uchar(out, toks, &data[i], "data byte", 1); | ||
| 405 | if (rv != ENOSPC) { | ||
| 406 | - out->printf(out, "**Error: input data too long for FRU\n", rv, i); | ||
| 407 | + out->eprintf(out, "**Error: input data too long for FRU\n", rv, i); | ||
| 408 | return EINVAL; | ||
| 409 | } | ||
| 410 | |||
| 411 | @@ -958,9 +958,9 @@ mc_add_fru_data(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 412 | |||
| 413 | rv = ipmi_mc_add_fru_data(mc, devid, length, NULL, data); | ||
| 414 | if (rv) | ||
| 415 | - out->printf(out, "**Unable to add FRU data, error 0x%x\n", rv); | ||
| 416 | + out->eprintf(out, "**Unable to add FRU data, error 0x%x\n", rv); | ||
| 417 | } else { | ||
| 418 | - out->printf(out, "**FRU type not given, need file or data\n"); | ||
| 419 | + out->eprintf(out, "**FRU type not given, need file or data\n"); | ||
| 420 | rv = EINVAL; | ||
| 421 | } | ||
| 422 | return rv; | ||
| 423 | @@ -981,28 +981,28 @@ mc_dump_fru_data(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 424 | |||
| 425 | rv = ipmi_mc_get_fru_data_len(mc, devid, &length); | ||
| 426 | if (rv) { | ||
| 427 | - out->printf(out, "**Unable to dump FRU data, error 0x%x\n", rv); | ||
| 428 | + out->eprintf(out, "**Unable to dump FRU data, error 0x%x\n", rv); | ||
| 429 | goto out; | ||
| 430 | } | ||
| 431 | |||
| 432 | data = malloc(length); | ||
| 433 | if (!data) { | ||
| 434 | - out->printf(out, "**Unable to dump FRU data, out of memory\n", rv); | ||
| 435 | + out->eprintf(out, "**Unable to dump FRU data, out of memory\n", rv); | ||
| 436 | goto out; | ||
| 437 | } | ||
| 438 | |||
| 439 | rv = ipmi_mc_get_fru_data(mc, devid, length, data); | ||
| 440 | if (rv) { | ||
| 441 | - out->printf(out, "**Unable to dump FRU data, error 0x%x\n", rv); | ||
| 442 | + out->eprintf(out, "**Unable to dump FRU data, error 0x%x\n", rv); | ||
| 443 | goto out; | ||
| 444 | } | ||
| 445 | |||
| 446 | for (i=0; i<length; i++) { | ||
| 447 | if ((i > 0) && ((i % 8) == 0)) | ||
| 448 | - out->printf(out, "\n"); | ||
| 449 | - out->printf(out, " 0x%2.2x", data[i]); | ||
| 450 | + out->eprintf(out, "\n"); | ||
| 451 | + out->eprintf(out, " 0x%2.2x", data[i]); | ||
| 452 | } | ||
| 453 | - out->printf(out, "\n"); | ||
| 454 | + out->eprintf(out, "\n"); | ||
| 455 | |||
| 456 | out: | ||
| 457 | if (data) | ||
| 458 | @@ -1021,7 +1021,7 @@ mc_setbmc(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 459 | return rv; | ||
| 460 | rv = ipmi_emu_set_bmc_mc(emu, ipmb); | ||
| 461 | if (rv) | ||
| 462 | - out->printf(out, "**Invalid IPMB address\n"); | ||
| 463 | + out->eprintf(out, "**Invalid IPMB address\n"); | ||
| 464 | return rv; | ||
| 465 | } | ||
| 466 | |||
| 467 | @@ -1032,7 +1032,7 @@ atca_enable(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 468 | |||
| 469 | rv = ipmi_emu_atca_enable(emu); | ||
| 470 | if (rv) | ||
| 471 | - out->printf(out, "**Unable to enable ATCA mode, error 0x%x\n", rv); | ||
| 472 | + out->eprintf(out, "**Unable to enable ATCA mode, error 0x%x\n", rv); | ||
| 473 | return rv; | ||
| 474 | } | ||
| 475 | |||
| 476 | @@ -1056,7 +1056,7 @@ atca_set_site(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 477 | |||
| 478 | rv = ipmi_emu_atca_set_site(emu, hw_address, site_type, site_number); | ||
| 479 | if (rv) | ||
| 480 | - out->printf(out, "**Unable to set site type, error 0x%x\n", rv); | ||
| 481 | + out->eprintf(out, "**Unable to set site type, error 0x%x\n", rv); | ||
| 482 | return rv; | ||
| 483 | } | ||
| 484 | |||
| 485 | @@ -1072,7 +1072,7 @@ mc_set_num_leds(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 486 | |||
| 487 | rv = ipmi_mc_set_num_leds(mc, count); | ||
| 488 | if (rv) | ||
| 489 | - out->printf(out, "**Unable to set number of LEDs, error 0x%x\n", rv); | ||
| 490 | + out->eprintf(out, "**Unable to set number of LEDs, error 0x%x\n", rv); | ||
| 491 | return rv; | ||
| 492 | } | ||
| 493 | |||
| 494 | @@ -1085,7 +1085,7 @@ read_cmds(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 495 | |||
| 496 | err = get_delim_str(toks, &filename, &errstr); | ||
| 497 | if (err) { | ||
| 498 | - out->printf(out, "Could not get include filename: %s\n", errstr); | ||
| 499 | + out->eprintf(out, "Could not get include filename: %s\n", errstr); | ||
| 500 | return err; | ||
| 501 | } | ||
| 502 | |||
| 503 | @@ -1097,7 +1097,7 @@ read_cmds(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 504 | { | ||
| 505 | char *nf = malloc(strlen(BASE_CONF_STR) + strlen(filename) + 2); | ||
| 506 | if (!nf) { | ||
| 507 | - out->printf(out, "Out of memory in include\n", errstr); | ||
| 508 | + out->eprintf(out, "Out of memory in include\n", errstr); | ||
| 509 | goto out_err; | ||
| 510 | } | ||
| 511 | strcpy(nf, BASE_CONF_STR); | ||
| 512 | @@ -1107,7 +1107,7 @@ read_cmds(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 513 | filename = nf; | ||
| 514 | err = read_command_file(out, emu, filename); | ||
| 515 | if (err) { | ||
| 516 | - out->printf(out, "Could not read include file %s\n", filename); | ||
| 517 | + out->eprintf(out, "Could not read include file %s\n", filename); | ||
| 518 | } | ||
| 519 | } | ||
| 520 | |||
| 521 | @@ -1147,7 +1147,7 @@ debug_cmd(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 522 | } else if (strcmp(tok, "sol") == 0) { | ||
| 523 | level |= DEBUG_SOL; | ||
| 524 | } else { | ||
| 525 | - out->printf(out, "Invalid debug level '%s', options are 'raw' and 'msg'\n", | ||
| 526 | + out->eprintf(out, "Invalid debug level '%s', options are 'raw' and 'msg'\n", | ||
| 527 | tok); | ||
| 528 | return EINVAL; | ||
| 529 | } | ||
| 530 | @@ -1168,7 +1168,7 @@ persist_cmd(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 531 | } else if (strcmp(tok, "off") == 0) { | ||
| 532 | persist_enable = 0; | ||
| 533 | } else { | ||
| 534 | - out->printf(out, "Invalid persist vale '%s', options are 'on' and 'off'\n", | ||
| 535 | + out->eprintf(out, "Invalid persist vale '%s', options are 'on' and 'off'\n", | ||
| 536 | tok); | ||
| 537 | return EINVAL; | ||
| 538 | } | ||
| 539 | @@ -1194,18 +1194,18 @@ do_define(emu_out_t *out, emu_data_t *emu, lmc_data_t *mc, char **toks) | ||
| 540 | |||
| 541 | name = mystrtok(NULL, " \t\n", toks); | ||
| 542 | if (!name) { | ||
| 543 | - out->printf(out, "No variable name given for define\n"); | ||
| 544 | + out->eprintf(out, "No variable name given for define\n"); | ||
| 545 | return EINVAL; | ||
| 546 | } | ||
| 547 | err = get_delim_str(toks, &value, &errstr); | ||
| 548 | if (err) { | ||
| 549 | - out->printf(out, "Could not get variable %s value: %s\n", name, errstr); | ||
| 550 | + out->eprintf(out, "Could not get variable %s value: %s\n", name, errstr); | ||
| 551 | return err; | ||
| 552 | } | ||
| 553 | err = add_variable(name, value); | ||
| 554 | if (err) { | ||
| 555 | free(value); | ||
| 556 | - out->printf(out, "Out of memory setting variable %s\n", name); | ||
| 557 | + out->eprintf(out, "Out of memory setting variable %s\n", name); | ||
| 558 | return err; | ||
| 559 | } | ||
| 560 | return 0; | ||
| 561 | @@ -1301,7 +1301,7 @@ ipmi_emu_cmd(emu_out_t *out, emu_data_t *emu, char *cmd_str) | ||
| 562 | return rv; | ||
| 563 | rv = ipmi_emu_get_mc_by_addr(emu, ipmb, &mc); | ||
| 564 | if (rv) { | ||
| 565 | - out->printf(out, "**Invalid MC address\n"); | ||
| 566 | + out->eprintf(out, "**Invalid MC address\n"); | ||
| 567 | return rv; | ||
| 568 | } | ||
| 569 | } | ||
| 570 | @@ -1312,7 +1312,7 @@ ipmi_emu_cmd(emu_out_t *out, emu_data_t *emu, char *cmd_str) | ||
| 571 | } | ||
| 572 | } | ||
| 573 | |||
| 574 | - out->printf(out, "**Unknown command: %s\n", cmd); | ||
| 575 | + out->eprintf(out, "**Unknown command: %s\n", cmd); | ||
| 576 | |||
| 577 | out: | ||
| 578 | return rv; | ||
| 579 | diff --git a/lanserv/ipmi_sim.c b/lanserv/ipmi_sim.c | ||
| 580 | index 9472cce..30c4f27 100644 | ||
| 581 | --- a/lanserv/ipmi_sim.c | ||
| 582 | +++ b/lanserv/ipmi_sim.c | ||
| 583 | @@ -607,8 +607,8 @@ isim_log(sys_data_t *sys, int logtype, msg_t *msg, const char *format, | ||
| 584 | |||
| 585 | con = data->consoles; | ||
| 586 | while (con) { | ||
| 587 | - con->out.printf(&con->out, "%s", str); | ||
| 588 | - con->out.printf(&con->out, "\n"); | ||
| 589 | + con->out.eprintf(&con->out, "%s", str); | ||
| 590 | + con->out.eprintf(&con->out, "\n"); | ||
| 591 | con = con->next; | ||
| 592 | } | ||
| 593 | #if HAVE_SYSLOG | ||
| 594 | @@ -956,7 +956,7 @@ console_bind_ready(int fd, void *cb_data, os_hnd_fd_id_t *id) | ||
| 595 | newcon->shutdown_on_close = 0; | ||
| 596 | newcon->telnet = 1; | ||
| 597 | newcon->tn_pos = 0; | ||
| 598 | - newcon->out.printf = emu_printf; | ||
| 599 | + newcon->out.eprintf = emu_printf; | ||
| 600 | newcon->out.data = newcon; | ||
| 601 | |||
| 602 | setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); | ||
| 603 | @@ -1463,10 +1463,10 @@ main(int argc, const char *argv[]) | ||
| 604 | stdio_console.telnet = 0; | ||
| 605 | stdio_console.tn_pos = 0; | ||
| 606 | if (nostdio) { | ||
| 607 | - stdio_console.out.printf = dummy_printf; | ||
| 608 | + stdio_console.out.eprintf = dummy_printf; | ||
| 609 | stdio_console.out.data = &stdio_console; | ||
| 610 | } else { | ||
| 611 | - stdio_console.out.printf = emu_printf; | ||
| 612 | + stdio_console.out.eprintf = emu_printf; | ||
| 613 | stdio_console.out.data = &stdio_console; | ||
| 614 | } | ||
| 615 | stdio_console.next = NULL; | ||
| 616 | -- | ||
| 617 | 2.14.1 | ||
| 618 | |||
diff --git a/meta-networking/recipes-support/openipmi/files/do-not-install-pyc-and-pyo.patch b/meta-networking/recipes-support/openipmi/files/do-not-install-pyc-and-pyo.patch new file mode 100644 index 0000000000..d4e02be450 --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/do-not-install-pyc-and-pyo.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | Do not install pyc and pyo for python module | ||
| 2 | |||
| 3 | Upstream-Status: Inappropriate [embedded specific] | ||
| 4 | |||
| 5 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
| 6 | --- | ||
| 7 | swig/python/Makefile.am | 2 -- | ||
| 8 | 1 file changed, 2 deletions(-) | ||
| 9 | |||
| 10 | diff --git a/swig/python/Makefile.am b/swig/python/Makefile.am | ||
| 11 | index da95a81..97a62bf 100644 | ||
| 12 | --- a/swig/python/Makefile.am | ||
| 13 | +++ b/swig/python/Makefile.am | ||
| 14 | @@ -33,8 +33,6 @@ CLEANFILES = OpenIPMI_wrap.c OpenIPMI.py OpenIPMI.pyo OpenIPMI.pyc | ||
| 15 | install-exec-local: _OpenIPMI.la OpenIPMI.py OpenIPMI.pyc OpenIPMI.pyo | ||
| 16 | $(INSTALL) -d $(DESTDIR)$(PYTHON_INSTALL_DIR) | ||
| 17 | $(INSTALL_DATA) OpenIPMI.py "$(DESTDIR)$(PYTHON_INSTALL_DIR)" | ||
| 18 | - $(INSTALL_DATA) OpenIPMI.pyc "$(DESTDIR)$(PYTHON_INSTALL_DIR)" | ||
| 19 | - $(INSTALL_DATA) OpenIPMI.pyo "$(DESTDIR)$(PYTHON_INSTALL_DIR)" | ||
| 20 | if test "x$(PYTHON_GUI_DIR)" = "xopenipmigui"; then \ | ||
| 21 | $(INSTALL) -d $(DESTDIR)$(bindir); \ | ||
| 22 | $(INSTALL_SCRIPT) $(srcdir)/openipmigui.py "$(DESTDIR)$(bindir)/openipmigui";\ | ||
| 23 | -- | ||
| 24 | 1.9.1 | ||
| 25 | |||
diff --git a/meta-networking/recipes-support/openipmi/files/fix-symlink-install-error-in-cmdlang.patch b/meta-networking/recipes-support/openipmi/files/fix-symlink-install-error-in-cmdlang.patch new file mode 100644 index 0000000000..9a568b2b22 --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/fix-symlink-install-error-in-cmdlang.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | Author: Aws Ismail <aws.ismail@windriver.com> | ||
| 2 | Date: Thu Jun 7 16:00:13 2012 -0400 | ||
| 3 | |||
| 4 | This patch fixes the error during the install stage when | ||
| 5 | creating a symbolic link for opeipmish in openipmi/cmdlang | ||
| 6 | |||
| 7 | Upstream-Status: Pending | ||
| 8 | |||
| 9 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
| 10 | |||
| 11 | diff --git a/cmdlang/Makefile.am b/cmdlang/Makefile.am | ||
| 12 | index 92d6e83..f6039f9 100644 | ||
| 13 | --- a/cmdlang/Makefile.am | ||
| 14 | +++ b/cmdlang/Makefile.am | ||
| 15 | @@ -36,6 +36,7 @@ CLEANFILES = libOpenIPMIcmdlang.map | ||
| 16 | # compatability. | ||
| 17 | install-data-local: | ||
| 18 | rm -f $(DESTDIR)$(bindir)/ipmish | ||
| 19 | + mkdir -p $(DESTDIR)$(bindir)/ | ||
| 20 | $(LN_S) openipmish $(DESTDIR)$(bindir)/ipmish | ||
| 21 | |||
| 22 | uninstall-local: | ||
diff --git a/meta-networking/recipes-support/openipmi/files/include_sys_types.patch b/meta-networking/recipes-support/openipmi/files/include_sys_types.patch new file mode 100644 index 0000000000..58ec5d8834 --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/include_sys_types.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | include sys/types.h for u_int32_t | ||
| 2 | |||
| 3 | ui.c:340:5: error: unknown type name 'u_int32_t'; did you mean 'uint32_t'? | ||
| 4 | u_int32_t addr; | ||
| 5 | ^~~~~~~~~ | ||
| 6 | Index: OpenIPMI-2.0.22/ui/ui.c | ||
| 7 | =================================================================== | ||
| 8 | --- OpenIPMI-2.0.22.orig/ui/ui.c | ||
| 9 | +++ OpenIPMI-2.0.22/ui/ui.c | ||
| 10 | @@ -42,6 +42,7 @@ | ||
| 11 | #include <fcntl.h> | ||
| 12 | #include <time.h> | ||
| 13 | #include <sys/time.h> | ||
| 14 | +#include <sys/types.h> | ||
| 15 | #include <ctype.h> | ||
| 16 | |||
| 17 | #include <OpenIPMI/selector.h> | ||
diff --git a/meta-networking/recipes-support/openipmi/files/ipmi-init-fix-the-arguments.patch b/meta-networking/recipes-support/openipmi/files/ipmi-init-fix-the-arguments.patch new file mode 100644 index 0000000000..51a398ba53 --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/ipmi-init-fix-the-arguments.patch | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | Subject: [PATCH] ipmi-init: fix the arguments | ||
| 2 | |||
| 3 | The functions success/failure/warning defined in /etc/init.d/functions | ||
| 4 | (provided by initscripts) only accepts numeric argument as return code, | ||
| 5 | not a string. | ||
| 6 | |||
| 7 | Upstream-Status: Inappropriate [OE specific] | ||
| 8 | |||
| 9 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
| 10 | --- | ||
| 11 | ipmi.init | 6 +++--- | ||
| 12 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/ipmi.init b/ipmi.init | ||
| 15 | index 2ebcd94..d8161c5 100644 | ||
| 16 | --- a/ipmi.init | ||
| 17 | +++ b/ipmi.init | ||
| 18 | @@ -45,17 +45,17 @@ elif [ -r /etc/init.d/functions ]; then | ||
| 19 | case "$ACTION" in | ||
| 20 | success) | ||
| 21 | echo -n $* | ||
| 22 | - success "$*" | ||
| 23 | + success 0 | ||
| 24 | echo | ||
| 25 | ;; | ||
| 26 | failure) | ||
| 27 | echo -n $* | ||
| 28 | - failure "$*" | ||
| 29 | + failure 1 | ||
| 30 | echo | ||
| 31 | ;; | ||
| 32 | warning) | ||
| 33 | echo -n $* | ||
| 34 | - warning "$*" | ||
| 35 | + warning 0 | ||
| 36 | echo | ||
| 37 | ;; | ||
| 38 | *) | ||
| 39 | -- | ||
| 40 | 1.9.1 | ||
| 41 | |||
diff --git a/meta-networking/recipes-support/openipmi/files/ipmi.service b/meta-networking/recipes-support/openipmi/files/ipmi.service new file mode 100644 index 0000000000..6fe1378191 --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/ipmi.service | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=IPMI Driver | ||
| 3 | After=network.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | Type=oneshot | ||
| 7 | RemainAfterExit=yes | ||
| 8 | ExecStart=@LIBEXECDIR@/openipmi-helper start | ||
| 9 | ExecStop=@LIBEXECDIR@/openipmi-helper stop-all | ||
| 10 | |||
| 11 | [Install] | ||
| 12 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-support/openipmi/files/openipmi-helper b/meta-networking/recipes-support/openipmi/files/openipmi-helper new file mode 100755 index 0000000000..4cebfb9c6a --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/openipmi-helper | |||
| @@ -0,0 +1,512 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | ############################################################################# | ||
| 3 | # | ||
| 4 | # ipmi: OpenIPMI Driver helper script | ||
| 5 | # | ||
| 6 | # Authors: Jan Safranek <jsafrane@redhat.com> | ||
| 7 | # | ||
| 8 | # Based on IPMI init script by: | ||
| 9 | # Matt Domsch <Matt_Domsch@dell.com> | ||
| 10 | # Chris Poblete <Chris_Poblete@dell.com> | ||
| 11 | # | ||
| 12 | # Status return code bits | ||
| 13 | # no bits set = no errors | ||
| 14 | # bit 0 set = minimum modules aren't loaded | ||
| 15 | # bit 1 set = requested feature module isn't loaded | ||
| 16 | # bit 2 set = /dev/ipmi0 (or /dev/imb if using that instead) doesn't exist | ||
| 17 | # bit 3 set = /dev/watchdog doesn't exist | ||
| 18 | # bit 4 set = lockfile doesn't exist | ||
| 19 | # bit 5 set = modules are loaded even when asked to be unloaded | ||
| 20 | |||
| 21 | CONFIGFILE=/etc/sysconfig/ipmi | ||
| 22 | # source config info | ||
| 23 | [ -r ${CONFIGFILE} ] && . ${CONFIGFILE} | ||
| 24 | |||
| 25 | ############################################################################# | ||
| 26 | # GLOBALS | ||
| 27 | ############################################################################# | ||
| 28 | MODULE_NAME="ipmi" | ||
| 29 | INTF_NUM=0 | ||
| 30 | |||
| 31 | IPMI_SMB_MODULE_NAME="ipmi_smb" | ||
| 32 | IPMI_SI_MODULE_NAME="ipmi_si" | ||
| 33 | kernel=`uname -r | cut -d. -f1-2` | ||
| 34 | if [ "${kernel}" == "2.4" ]; then | ||
| 35 | IPMI_SMB_MODULE_NAME="ipmi_smb_intf" | ||
| 36 | IPMI_SI_MODULE_NAME="ipmi_si_drv" | ||
| 37 | fi | ||
| 38 | |||
| 39 | MODULES_INTERFACES="" | ||
| 40 | [ "${DEV_IPMI}" = "yes" ] && MODULES_INTERFACES="${MODULES_INTERFACES} ipmi_devintf" | ||
| 41 | [ "${IPMI_IMB}" = "yes" ] && MODULES_INTERFACES="${MODULES_INTERFACES} ipmi_imb" | ||
| 42 | |||
| 43 | MODULES_FEATURES="" | ||
| 44 | [ "${IPMI_WATCHDOG}" = "yes" ] && MODULES_FEATURES="${MODULES_FEATURES} ipmi_watchdog" | ||
| 45 | [ "${IPMI_POWEROFF}" = "yes" ] && MODULES_FEATURES="${MODULES_FEATURES} ipmi_poweroff" | ||
| 46 | |||
| 47 | MODULES_HW="" | ||
| 48 | [ "${IPMI_SI}" = "yes" ] && MODULES_HW="${MODULES_HW} ${IPMI_SI_MODULE_NAME}" | ||
| 49 | [ "${IPMI_SMB}" = "yes" ] && MODULES_HW="${MODULES_HW} ${IPMI_SMB_MODULE_NAME}" | ||
| 50 | |||
| 51 | MODULES_BASE="ipmi_msghandler" | ||
| 52 | MODULES="${MODULES_INTERFACES} ${MODULES_FEATURES} ${MODULES_HW} ${MODULES_BASE}" | ||
| 53 | |||
| 54 | RETVAL=0 | ||
| 55 | LOCKFILE=/var/lock/subsys/ipmi | ||
| 56 | DEV_IPMI_TIMEOUT=150 | ||
| 57 | |||
| 58 | UDEV_EXISTS=0 | ||
| 59 | if [ -e /sbin/udev -o -e /sbin/udevd ]; then | ||
| 60 | UDEV_EXISTS=1 | ||
| 61 | fi | ||
| 62 | |||
| 63 | ############################################################################# | ||
| 64 | # NOTES: | ||
| 65 | # * /dev/ipmi0 is unconditionally deleted here on ipmi_devintf unload, | ||
| 66 | # because SLES9 and RHEL4 kernels don't send a message for udev to delete | ||
| 67 | # it for us. | ||
| 68 | # | ||
| 69 | ############################################################################# | ||
| 70 | |||
| 71 | modules_loaded_verbose() | ||
| 72 | { | ||
| 73 | OnePlusLoaded=0 | ||
| 74 | OnePlusUnloaded=0 | ||
| 75 | for m in $@; do | ||
| 76 | if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then | ||
| 77 | echo "$m module loaded." | ||
| 78 | OnePlusLoaded=1 | ||
| 79 | else | ||
| 80 | echo "$m module not loaded." | ||
| 81 | OnePlusUnloaded=1 | ||
| 82 | fi | ||
| 83 | done | ||
| 84 | } | ||
| 85 | |||
| 86 | modules_loaded() | ||
| 87 | { | ||
| 88 | OnePlusLoaded=0 | ||
| 89 | OnePlusUnloaded=0 | ||
| 90 | for m in $@; do | ||
| 91 | if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then | ||
| 92 | OnePlusLoaded=1 | ||
| 93 | else | ||
| 94 | OnePlusUnloaded=1 | ||
| 95 | fi | ||
| 96 | done | ||
| 97 | } | ||
| 98 | |||
| 99 | device_node_exists () | ||
| 100 | { | ||
| 101 | if [ -e "$1" ]; then | ||
| 102 | echo "$1 exists." | ||
| 103 | return 1 | ||
| 104 | fi | ||
| 105 | echo "$1 does not exist." | ||
| 106 | return 0 | ||
| 107 | } | ||
| 108 | |||
| 109 | minimum_modules_loaded() | ||
| 110 | { | ||
| 111 | rc_base=1 | ||
| 112 | rc_hw=1 | ||
| 113 | modules_loaded_verbose "${MODULES_BASE}" | ||
| 114 | [ ${OnePlusLoaded} -eq 0 ] && rc_base=0 | ||
| 115 | |||
| 116 | modules_loaded_verbose "${MODULES_HW}" | ||
| 117 | [ ${OnePlusLoaded} -eq 0 ] && rc_hw=0 | ||
| 118 | |||
| 119 | return $((rc_base && rc_hw)) | ||
| 120 | } | ||
| 121 | |||
| 122 | ############################################################################# | ||
| 123 | |||
| 124 | load_si() | ||
| 125 | { | ||
| 126 | if [ "${IPMI_SI}" = "yes" ]; then | ||
| 127 | modprobe ${IPMI_SI_MODULE_NAME} > /dev/null 2>&1 | ||
| 128 | modules_loaded ${IPMI_SI_MODULE_NAME} | ||
| 129 | [ ${OnePlusLoaded} -ne 1 ] && RETVAL=$((RETVAL | 1)) | ||
| 130 | fi | ||
| 131 | } | ||
| 132 | |||
| 133 | load_smb() | ||
| 134 | { | ||
| 135 | if [ "${IPMI_SMB}" = "yes" ]; then | ||
| 136 | modprobe ${IPMI_SMB_MODULE_NAME} > /dev/null 2>&1 | ||
| 137 | modules_loaded ${IPMI_SMB_MODULE_NAME} | ||
| 138 | [ ${OnePlusLoaded} -ne 1 ] && RETVAL=$((RETVAL | 1)) | ||
| 139 | fi | ||
| 140 | } | ||
| 141 | |||
| 142 | load_hw_modules() | ||
| 143 | { | ||
| 144 | load_si | ||
| 145 | load_smb | ||
| 146 | } | ||
| 147 | |||
| 148 | start_watchdog_common() | ||
| 149 | { | ||
| 150 | load_hw_modules | ||
| 151 | modprobe ipmi_watchdog ${IPMI_WATCHDOG_OPTIONS} > /dev/null 2>&1 | ||
| 152 | modules_loaded ipmi_watchdog | ||
| 153 | [ ${OnePlusUnloaded} -ne 0 ] && | ||
| 154 | RETVAL=$((RETVAL | 2)) && | ||
| 155 | echo "Watchdog startup failed: cannot load ipmi_watchdog module" && | ||
| 156 | return | ||
| 157 | if [ ${UDEV_EXISTS} -eq 0 -a ! -e /dev/watchdog ]; then | ||
| 158 | mknod -m 0600 /dev/watchdog c 10 130 | ||
| 159 | [ $? -ne 0 ] && | ||
| 160 | RETVAL=$((RETVAL | 8)) && | ||
| 161 | echo "Watchdog startup failed: cannot create /dev/watchdog" && | ||
| 162 | return | ||
| 163 | fi | ||
| 164 | } | ||
| 165 | |||
| 166 | start_watchdog_quiet() | ||
| 167 | { | ||
| 168 | [ "${IPMI_WATCHDOG}" != "yes" ] && | ||
| 169 | return | ||
| 170 | start_watchdog_common | ||
| 171 | } | ||
| 172 | |||
| 173 | start_watchdog() | ||
| 174 | { | ||
| 175 | [ "${IPMI_WATCHDOG}" != "yes" ] && | ||
| 176 | RETVAL=$((RETVAL | 2)) && | ||
| 177 | echo "Watchdog not configured" && | ||
| 178 | return | ||
| 179 | start_watchdog_common | ||
| 180 | } | ||
| 181 | |||
| 182 | stop_watchdog() | ||
| 183 | { | ||
| 184 | modprobe -q -r ipmi_watchdog > /dev/null 2>&1 | ||
| 185 | modules_loaded ipmi_watchdog | ||
| 186 | if [ ${OnePlusLoaded} -ne 0 ]; then | ||
| 187 | RETVAL=$((RETVAL | 32)) | ||
| 188 | echo "Watchog shutdown failed: cannot unload ipmi_watchdog module" | ||
| 189 | else | ||
| 190 | if [ "${IPMI_WATCHDOG}" = "yes" ]; then | ||
| 191 | [ ${UDEV_EXISTS} -eq 0 ] && rm -f /dev/watchdog | ||
| 192 | fi | ||
| 193 | fi | ||
| 194 | } | ||
| 195 | |||
| 196 | stop_watchdog_quiet() | ||
| 197 | { | ||
| 198 | modprobe -q -r ipmi_watchdog > /dev/null 2>&1 | ||
| 199 | modules_loaded ipmi_watchdog | ||
| 200 | if [ ${OnePlusLoaded} -ne 0 ]; then | ||
| 201 | RETVAL=$((RETVAL | 32)) | ||
| 202 | else | ||
| 203 | if [ "${IPMI_WATCHDOG}" = "yes" ]; then | ||
| 204 | [ ${UDEV_EXISTS} -eq 0 ] && rm -f /dev/watchdog | ||
| 205 | fi | ||
| 206 | fi | ||
| 207 | } | ||
| 208 | |||
| 209 | start_powercontrol_common() | ||
| 210 | { | ||
| 211 | local poweroff_opts="" | ||
| 212 | load_hw_modules | ||
| 213 | if [ "${IPMI_POWERCYCLE}" == "yes" ]; then | ||
| 214 | modinfo ipmi_poweroff 2>/dev/null | grep poweroff_control > /dev/null 2>&1 && \ | ||
| 215 | poweroff_opts="poweroff_control=2" | ||
| 216 | modinfo ipmi_poweroff 2>/dev/null | grep poweroff_powercycle > /dev/null 2>&1 && \ | ||
| 217 | poweroff_opts="poweroff_powercycle=1" | ||
| 218 | fi | ||
| 219 | modprobe ipmi_poweroff "${poweroff_opts}" > /dev/null 2>&1 | ||
| 220 | modules_loaded ipmi_poweroff | ||
| 221 | [ ${OnePlusUnloaded} -ne 0 ] && | ||
| 222 | RETVAL=$((RETVAL | 2)) && | ||
| 223 | echo "Powercontroll startup failed: cannot load ipmi_poweroff module" && | ||
| 224 | return | ||
| 225 | } | ||
| 226 | |||
| 227 | start_powercontrol_quiet() | ||
| 228 | { | ||
| 229 | [ "${IPMI_POWEROFF}" != "yes" ] && | ||
| 230 | return | ||
| 231 | start_powercontrol_common | ||
| 232 | } | ||
| 233 | |||
| 234 | start_powercontrol() | ||
| 235 | { | ||
| 236 | [ "${IPMI_POWEROFF}" != "yes" ] && | ||
| 237 | RETVAL=$((RETVAL | 2)) && | ||
| 238 | echo "Powercontroll not configured" && | ||
| 239 | return | ||
| 240 | start_powercontrol_common | ||
| 241 | } | ||
| 242 | |||
| 243 | stop_powercontrol() | ||
| 244 | { | ||
| 245 | modprobe -q -r ipmi_poweroff > /dev/null 2>&1 | ||
| 246 | modules_loaded ipmi_poweroff | ||
| 247 | if [ ${OnePlusLoaded} -ne 0 ]; then | ||
| 248 | RETVAL=$((RETVAL | 32)) | ||
| 249 | echo "Powercontroll shutdown failed: cannot unload ipmi_poweroff module" | ||
| 250 | fi | ||
| 251 | } | ||
| 252 | |||
| 253 | stop_powercontrol_quiet() | ||
| 254 | { | ||
| 255 | modprobe -q -r ipmi_poweroff > /dev/null 2>&1 | ||
| 256 | modules_loaded ipmi_poweroff | ||
| 257 | [ ${OnePlusLoaded} -ne 0 ] && RETVAL=$((RETVAL | 32)) | ||
| 258 | } | ||
| 259 | |||
| 260 | ############################################################################# | ||
| 261 | unload_all_ipmi_modules() | ||
| 262 | { | ||
| 263 | stop_watchdog_quiet | ||
| 264 | stop_powercontrol_quiet | ||
| 265 | for m in ${MODULES}; do | ||
| 266 | modprobe -q -r ${m} > /dev/null 2>&1 | ||
| 267 | done | ||
| 268 | # delete interface node ONLY if ipmi_devintf is unloaded | ||
| 269 | [ `lsmod | grep -c "ipmi_devintf"` -eq 0 ] && | ||
| 270 | rm -f "/dev/ipmi${INTF_NUM}" | ||
| 271 | } | ||
| 272 | |||
| 273 | unload_ipmi_modules_leave_features() | ||
| 274 | { | ||
| 275 | for m in ${MODULES_INTERFACES}; do | ||
| 276 | modprobe -q -r ${m} > /dev/null 2>&1 | ||
| 277 | done | ||
| 278 | # delete interface node ONLY if ipmi_devintf is unloaded | ||
| 279 | [ `lsmod | grep -c "ipmi_devintf"` -eq 0 ] && | ||
| 280 | rm -f "/dev/ipmi${INTF_NUM}" | ||
| 281 | lsmod | egrep -q "ipmi_(poweroff|watchdog)" > /dev/null 2>&1 | ||
| 282 | if [ "$?" -ne "0" ]; then | ||
| 283 | stop_watchdog_quiet | ||
| 284 | stop_powercontrol_quiet | ||
| 285 | for m in ${MODULES}; do | ||
| 286 | modprobe -q -r ${m} > /dev/null 2>&1 | ||
| 287 | done | ||
| 288 | fi | ||
| 289 | } | ||
| 290 | |||
| 291 | ############################################################################# | ||
| 292 | load_ipmi_modules () | ||
| 293 | { | ||
| 294 | local locdelay | ||
| 295 | modprobe ipmi_msghandler > /dev/null 2>&1 | ||
| 296 | modules_loaded ipmi_msghandler | ||
| 297 | [ ${OnePlusLoaded} -ne 1 ] && unload_all_ipmi_modules && RETVAL=$((RETVAL | 1)) && return | ||
| 298 | load_hw_modules | ||
| 299 | [ $((RETVAL & 1)) -eq 1 ] && unload_all_ipmi_modules && RETVAL=$((RETVAL | 1)) && return | ||
| 300 | |||
| 301 | if [ "${DEV_IPMI}" = "yes" ]; then | ||
| 302 | modprobe ipmi_devintf > /dev/null 2>&1 | ||
| 303 | modules_loaded ipmi_devintf | ||
| 304 | RETVAL=$((RETVAL & ~2)) | ||
| 305 | [ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2)) | ||
| 306 | if [ ${OnePlusLoaded} -eq 1 ]; then | ||
| 307 | if [ ${UDEV_EXISTS} -eq 0 ]; then | ||
| 308 | DEVMAJOR=`cat /proc/devices | awk '/ipmidev/{print $1}'` | ||
| 309 | rm -f /dev/ipmi${INTF_NUM} | ||
| 310 | mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=$((RETVAL | 4)) | ||
| 311 | fi | ||
| 312 | |||
| 313 | # udev can take several seconds to create /dev/ipmi0, | ||
| 314 | # but it happens asynchronously, so delay here | ||
| 315 | locdelay=${DEV_IPMI_TIMEOUT} | ||
| 316 | while [ ! -e /dev/ipmi${INTF_NUM} -a ${locdelay} -gt 0 ]; do | ||
| 317 | locdelay=$((locdelay - 1)) | ||
| 318 | sleep 0.1 | ||
| 319 | done | ||
| 320 | fi | ||
| 321 | fi | ||
| 322 | |||
| 323 | if [ "${IPMI_IMB}" = "yes" ]; then | ||
| 324 | modprobe ipmi_imb > /dev/null 2>&1 | ||
| 325 | modules_loaded ipmi_imb | ||
| 326 | RETVAL=$((RETVAL & ~2)) | ||
| 327 | [ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2)) | ||
| 328 | if [ ${OnePlusLoaded} -eq 1 ]; then | ||
| 329 | DEVMAJOR=`cat /proc/devices | awk '/imb/{print $1}'` | ||
| 330 | rm -f /dev/imb | ||
| 331 | mknod -m 0600 /dev/imb c ${DEVMAJOR} 0 || RETVAL=$((RETVAL | 4)) | ||
| 332 | fi | ||
| 333 | fi | ||
| 334 | |||
| 335 | # Per Corey Minyard, essentially no one uses ipmi_radisys | ||
| 336 | # and we don't want to encourage its further use | ||
| 337 | # so it won't be handled here. | ||
| 338 | return | ||
| 339 | } | ||
| 340 | |||
| 341 | ############################################################################# | ||
| 342 | start() | ||
| 343 | { | ||
| 344 | load_ipmi_modules | ||
| 345 | if [ ${RETVAL} -eq 0 ]; then | ||
| 346 | touch ${LOCKFILE} | ||
| 347 | else | ||
| 348 | if [ $((RETVAL & 1)) -eq 1 ]; then | ||
| 349 | echo "Startup failed." | ||
| 350 | else | ||
| 351 | touch ${LOCKFILE} && echo "Warning!?" | ||
| 352 | fi | ||
| 353 | fi | ||
| 354 | start_watchdog_quiet | ||
| 355 | start_powercontrol_quiet | ||
| 356 | } | ||
| 357 | |||
| 358 | ############################################################################# | ||
| 359 | stop() | ||
| 360 | { | ||
| 361 | unload_ipmi_modules_leave_features | ||
| 362 | modules_loaded ${MODULES_INTERFACES} | ||
| 363 | if [ ${OnePlusLoaded} -ne 0 ]; then | ||
| 364 | RETVAL=$((RETVAL | 32)) | ||
| 365 | echo "Shutdown failed, something may be in use" | ||
| 366 | else | ||
| 367 | rm -f ${LOCKFILE} | ||
| 368 | fi | ||
| 369 | } | ||
| 370 | |||
| 371 | stop_all() | ||
| 372 | { | ||
| 373 | unload_all_ipmi_modules | ||
| 374 | modules_loaded ${MODULES} | ||
| 375 | if [ ${OnePlusLoaded} -ne 0 ]; then | ||
| 376 | RETVAL=$((RETVAL | 32)) | ||
| 377 | echo "Shutdown failed, something may be in use" | ||
| 378 | else | ||
| 379 | rm -f ${LOCKFILE} | ||
| 380 | fi | ||
| 381 | } | ||
| 382 | |||
| 383 | ############################################################################# | ||
| 384 | restart() | ||
| 385 | { | ||
| 386 | stop_all | ||
| 387 | RETVAL=0 | ||
| 388 | start | ||
| 389 | } | ||
| 390 | |||
| 391 | ############################################################################# | ||
| 392 | |||
| 393 | reload() | ||
| 394 | { | ||
| 395 | stop_all | ||
| 396 | RETVAL=0 | ||
| 397 | start | ||
| 398 | } | ||
| 399 | |||
| 400 | ############################################################################# | ||
| 401 | |||
| 402 | status_all() | ||
| 403 | { | ||
| 404 | minimum_modules_loaded | ||
| 405 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 1)) | ||
| 406 | |||
| 407 | modules_loaded_verbose ${MODULES_FEATURES} ${MODULES_INTERFACES} | ||
| 408 | [ ${OnePlusUnloaded} -ne 0 ] && RETVAL=$((RETVAL | 2)) | ||
| 409 | |||
| 410 | if [ "${DEV_IPMI}" = "yes" ]; then | ||
| 411 | device_node_exists /dev/ipmi${INTF_NUM} | ||
| 412 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 4)) | ||
| 413 | fi | ||
| 414 | |||
| 415 | if [ "${IPMI_IMB}" = "yes" ]; then | ||
| 416 | device_node_exists /dev/imb | ||
| 417 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 4)) | ||
| 418 | fi | ||
| 419 | |||
| 420 | if [ "${IPMI_WATCHDOG}" = "yes" ]; then | ||
| 421 | device_node_exists /dev/watchdog | ||
| 422 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 8)) | ||
| 423 | fi | ||
| 424 | |||
| 425 | [ ! -e ${LOCKFILE} ] && RETVAL=$((RETVAL | 16)) | ||
| 426 | } | ||
| 427 | |||
| 428 | status() | ||
| 429 | { | ||
| 430 | minimum_modules_loaded | ||
| 431 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 1)) | ||
| 432 | |||
| 433 | if [ "${DEV_IPMI}" = "yes" ]; then | ||
| 434 | modules_loaded_verbose ipmi_devintf | ||
| 435 | [ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2)) | ||
| 436 | |||
| 437 | device_node_exists /dev/ipmi${INTF_NUM} | ||
| 438 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 4)) | ||
| 439 | fi | ||
| 440 | |||
| 441 | if [ "${IPMI_IMB}" = "yes" ]; then | ||
| 442 | device_node_exists /dev/imb | ||
| 443 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 4)) | ||
| 444 | fi | ||
| 445 | } | ||
| 446 | |||
| 447 | status_watchdog() | ||
| 448 | { | ||
| 449 | minimum_modules_loaded | ||
| 450 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 1)) | ||
| 451 | |||
| 452 | modules_loaded_verbose ipmi_watchdog | ||
| 453 | [ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2)) | ||
| 454 | |||
| 455 | device_node_exists /dev/watchdog | ||
| 456 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 8)) | ||
| 457 | } | ||
| 458 | |||
| 459 | status_powercontrol() | ||
| 460 | { | ||
| 461 | minimum_modules_loaded | ||
| 462 | [ $? -eq 0 ] && RETVAL=$((RETVAL | 1)) | ||
| 463 | |||
| 464 | modules_loaded_verbose ipmi_powercontrol | ||
| 465 | [ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2)) | ||
| 466 | } | ||
| 467 | |||
| 468 | ############################################################################# | ||
| 469 | usage () | ||
| 470 | { | ||
| 471 | echo $"Usage: $0 {start|stop|status" 1>&2 | ||
| 472 | echo $" restart|condrestart|try-restart|reload|force-reload" 1>&2 | ||
| 473 | echo $" start-watchdog|stop-watchdog|status-watchdog" 1>&2 | ||
| 474 | echo $" start-powercontrol|stop-powercontrol|status-powercontrol" 1>&2 | ||
| 475 | echo $" stop-all|status-all}" 1>&2 | ||
| 476 | RETVAL=2 | ||
| 477 | } | ||
| 478 | |||
| 479 | condrestart () | ||
| 480 | { | ||
| 481 | [ -e ${LOCKFILE} ] && restart | ||
| 482 | } | ||
| 483 | |||
| 484 | ############################################################################# | ||
| 485 | # MAIN | ||
| 486 | ############################################################################# | ||
| 487 | case "$1" in | ||
| 488 | start) start ;; | ||
| 489 | stop) stop ;; | ||
| 490 | restart) restart ;; | ||
| 491 | force-reload) reload ;; | ||
| 492 | reload) reload ;; | ||
| 493 | status) status ;; | ||
| 494 | status-all) status_all ;; | ||
| 495 | condrestart) condrestart ;; | ||
| 496 | try-restart) condrestart ;; | ||
| 497 | start-watchdog) start_watchdog ;; | ||
| 498 | stop-watchdog) stop_watchdog ;; | ||
| 499 | status-watchdog) status_watchdog ;; | ||
| 500 | start-powercontrol) start_powercontrol ;; | ||
| 501 | stop-powercontrol) stop_powercontrol ;; | ||
| 502 | status-powercontrol) status_powercontrol ;; | ||
| 503 | stop-all) stop_all ;; | ||
| 504 | *) usage ;; | ||
| 505 | esac | ||
| 506 | |||
| 507 | exit ${RETVAL} | ||
| 508 | |||
| 509 | ############################################################################# | ||
| 510 | # end of file | ||
| 511 | ############################################################################# | ||
| 512 | |||
diff --git a/meta-networking/recipes-support/openipmi/files/openipmi-no-openipmigui-man.patch b/meta-networking/recipes-support/openipmi/files/openipmi-no-openipmigui-man.patch new file mode 100644 index 0000000000..1fa68f9bac --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/openipmi-no-openipmigui-man.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | Author: Aws Ismail <aws.ismail@windriver.com> | ||
| 2 | Date: Thu Jun 7 12:28:34 2012 -0400 | ||
| 3 | |||
| 4 | This patch was carried over from WRL4.3 (openipmi v2.0.16) | ||
| 5 | |||
| 6 | It was updated for openipmi v2.0.19 | ||
| 7 | |||
| 8 | Disable making openipmigui man page since we don't need it | ||
| 9 | |||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
| 13 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
| 14 | |||
| 15 | diff --git a/man/Makefile.am b/man/Makefile.am | ||
| 16 | index 632f55b..5ce79f5 100644 | ||
| 17 | --- a/man/Makefile.am | ||
| 18 | +++ b/man/Makefile.am | ||
| 19 | @@ -1,6 +1,6 @@ | ||
| 20 | |||
| 21 | man_MANS = ipmi_ui.1 openipmicmd.1 openipmish.1 ipmi_cmdlang.7 \ | ||
| 22 | - openipmigui.1 openipmi_conparms.7 solterm.1 rmcp_ping.1 \ | ||
| 23 | + openipmi_conparms.7 solterm.1 rmcp_ping.1 \ | ||
| 24 | openipmi_eventd.1 | ||
| 25 | |||
| 26 | EXTRA_DIST = $(man_MANS) | ||
diff --git a/meta-networking/recipes-support/openipmi/files/openipmi-remove-host-path-from-la_LDFLAGS.patch b/meta-networking/recipes-support/openipmi/files/openipmi-remove-host-path-from-la_LDFLAGS.patch new file mode 100644 index 0000000000..83485a9e60 --- /dev/null +++ b/meta-networking/recipes-support/openipmi/files/openipmi-remove-host-path-from-la_LDFLAGS.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | From aa0dc0783a6ff5fb56c914b640836223e3c192bb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jackie Huang <jackie.huang@windriver.com> | ||
| 3 | Date: Mon, 29 Dec 2014 18:16:04 +0800 | ||
| 4 | Subject: [PATCH] remove host path from la_LDFLAGS | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [ cross compile specific ] | ||
| 7 | |||
| 8 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
| 9 | --- | ||
| 10 | cmdlang/Makefile.am | 2 +- | ||
| 11 | glib/Makefile.am | 4 ++-- | ||
| 12 | tcl/Makefile.am | 2 +- | ||
| 13 | unix/Makefile.am | 4 ++-- | ||
| 14 | 4 files changed, 6 insertions(+), 6 deletions(-) | ||
| 15 | |||
| 16 | Index: OpenIPMI-2.0.24/cmdlang/Makefile.am | ||
| 17 | =================================================================== | ||
| 18 | --- OpenIPMI-2.0.24.orig/cmdlang/Makefile.am | ||
| 19 | +++ OpenIPMI-2.0.24/cmdlang/Makefile.am | ||
| 20 | @@ -15,8 +15,7 @@ libOpenIPMIcmdlang_la_SOURCES = cmdlang. | ||
| 21 | libOpenIPMIcmdlang_la_LIBADD = -lm \ | ||
| 22 | $(top_builddir)/utils/libOpenIPMIutils.la \ | ||
| 23 | $(top_builddir)/lib/libOpenIPMI.la | ||
| 24 | -libOpenIPMIcmdlang_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ | ||
| 25 | - -L$(libdir) | ||
| 26 | +libOpenIPMIcmdlang_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) | ||
| 27 | |||
| 28 | bin_PROGRAMS = openipmish | ||
| 29 | |||
| 30 | Index: OpenIPMI-2.0.24/unix/Makefile.am | ||
| 31 | =================================================================== | ||
| 32 | --- OpenIPMI-2.0.24.orig/unix/Makefile.am | ||
| 33 | +++ OpenIPMI-2.0.24/unix/Makefile.am | ||
| 34 | @@ -10,14 +10,12 @@ lib_LTLIBRARIES = libOpenIPMIposix.la li | ||
| 35 | libOpenIPMIpthread_la_SOURCES = posix_thread_os_hnd.c selector.c | ||
| 36 | libOpenIPMIpthread_la_LIBADD = -lpthread $(GDBM_LIB) \ | ||
| 37 | $(top_builddir)/utils/libOpenIPMIutils.la $(RT_LIB) | ||
| 38 | -libOpenIPMIpthread_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ | ||
| 39 | - -L$(libdir) | ||
| 40 | +libOpenIPMIpthread_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) | ||
| 41 | |||
| 42 | libOpenIPMIposix_la_SOURCES = posix_os_hnd.c selector.c | ||
| 43 | libOpenIPMIposix_la_LIBADD = $(top_builddir)/utils/libOpenIPMIutils.la \ | ||
| 44 | $(GDBM_LIB) $(RT_LIB) | ||
| 45 | -libOpenIPMIposix_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ | ||
| 46 | - -L$(libdir) | ||
| 47 | +libOpenIPMIposix_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) | ||
| 48 | |||
| 49 | noinst_HEADERS = heap.h | ||
| 50 | |||
diff --git a/meta-networking/recipes-support/openipmi/openipmi_2.0.24.bb b/meta-networking/recipes-support/openipmi/openipmi_2.0.24.bb new file mode 100644 index 0000000000..a4f63c5f4d --- /dev/null +++ b/meta-networking/recipes-support/openipmi/openipmi_2.0.24.bb | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | SUMMARY = "IPMI (Intelligent Platform Management Interface) library and tools" | ||
| 2 | DESCRIPTION = "OpenIPMI is an effort to create a full-function IPMI system, \ | ||
| 3 | to allow full access to all IPMI information on a server \ | ||
| 4 | and to abstract it to a level that will make it easy to use" | ||
| 5 | |||
| 6 | HOMEPAGE = "http://openipmi.sourceforge.net" | ||
| 7 | |||
| 8 | DEPENDS = " \ | ||
| 9 | glib-2.0 \ | ||
| 10 | ncurses \ | ||
| 11 | net-snmp \ | ||
| 12 | openssl \ | ||
| 13 | popt \ | ||
| 14 | python \ | ||
| 15 | swig-native \ | ||
| 16 | " | ||
| 17 | |||
| 18 | LICENSE = "GPLv2 & LGPLv2.1 & BSD" | ||
| 19 | |||
| 20 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ | ||
| 21 | file://COPYING.LIB;md5=d8045f3b8f929c1cb29a1e3fd737b499 \ | ||
| 22 | file://COPYING.BSD;md5=4b318d4160eb69c8ee53452feb1b4cdf \ | ||
| 23 | " | ||
| 24 | |||
| 25 | SRC_URI = "${SOURCEFORGE_MIRROR}/openipmi/OpenIPMI-${PV}.tar.gz \ | ||
| 26 | file://fix-symlink-install-error-in-cmdlang.patch \ | ||
| 27 | file://openipmi-no-openipmigui-man.patch \ | ||
| 28 | file://openipmi-remove-host-path-from-la_LDFLAGS.patch \ | ||
| 29 | file://ipmi-init-fix-the-arguments.patch \ | ||
| 30 | file://do-not-install-pyc-and-pyo.patch \ | ||
| 31 | file://include_sys_types.patch \ | ||
| 32 | file://openipmi-helper \ | ||
| 33 | file://ipmi.service \ | ||
| 34 | file://0001-lanserv-Rename-struct-parameter-printf-for-namespace.patch \ | ||
| 35 | " | ||
| 36 | |||
| 37 | S = "${WORKDIR}/OpenIPMI-${PV}" | ||
| 38 | SRC_URI[md5sum] = "58f9542cbfcb5fe250b77cf88345e1ec" | ||
| 39 | SRC_URI[sha256sum] = "bca39a27071278a8b74610181ede8df51e155e5e9031bc8eaa3699d1720292b4" | ||
| 40 | |||
| 41 | inherit autotools-brokensep pkgconfig pythonnative perlnative update-rc.d systemd | ||
| 42 | |||
| 43 | EXTRA_OECONF = "--disable-static \ | ||
| 44 | --with-perl='${STAGING_BINDIR_NATIVE}/perl-native/perl' \ | ||
| 45 | --with-python='${STAGING_BINDIR_NATIVE}/python-native/python' \ | ||
| 46 | --with-pythoninstall='${PYTHON_SITEPACKAGES_DIR}' \ | ||
| 47 | --with-glibver=2.0" | ||
| 48 | |||
| 49 | PACKAGECONFIG ??= "gdbm" | ||
| 50 | PACKAGECONFIG[gdbm] = "ac_cv_header_gdbm_h=yes,ac_cv_header_gdbm_h=no,gdbm," | ||
| 51 | |||
| 52 | PACKAGES += "${PN}-perl ${PN}-python" | ||
| 53 | |||
| 54 | FILES_${PN}-perl = " \ | ||
| 55 | ${libdir}/perl/vendor_perl/*/OpenIPMI.pm \ | ||
| 56 | ${libdir}/perl/vendor_perl/*/auto/OpenIPMI/OpenIPMI.so \ | ||
| 57 | " | ||
| 58 | |||
| 59 | FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}" | ||
| 60 | |||
| 61 | FILES_${PN}-dbg += " \ | ||
| 62 | ${libdir}/perl/vendor_perl/*/auto/OpenIPMI/.debug \ | ||
| 63 | ${PYTHON_SITEPACKAGES_DIR}/.debug \ | ||
| 64 | " | ||
| 65 | |||
| 66 | do_configure () { | ||
| 67 | |||
| 68 | # Let's perform regular configuration first then handle perl issues. | ||
| 69 | autotools_do_configure | ||
| 70 | |||
| 71 | perl_ver=`perl -V:version | cut -d\' -f 2` | ||
| 72 | |||
| 73 | # Force openipmi perl bindings to be compiled using perl-native instead of | ||
| 74 | # the host's perl. Set the proper install directory for the resulting | ||
| 75 | # openipmi.pm and openipmi.so | ||
| 76 | for i in ${S}/swig/Makefile ${S}/swig/perl/Makefile; do | ||
| 77 | echo "SAL: i = $i" | ||
| 78 | echo "SAL: STAGING_INCDIR_NATIVE = $STAGING_INCDIR_NATIVE" | ||
| 79 | echo "SAL: libdir = $libdir" | ||
| 80 | sed -i -e "/^PERL_CFLAGS/s:-I/usr/local/include:-I${STAGING_INCDIR_NATIVE}:g" $i | ||
| 81 | sed -i -e "/^PERL_INSTALL_DIR/s:^PERL_INSTALL_DIR = .*:PERL_INSTALL_DIR = ${libdir}/perl/vendor_perl/$perl_ver:g" $i | ||
| 82 | done | ||
| 83 | } | ||
| 84 | |||
| 85 | do_install_append () { | ||
| 86 | echo "SAL: D = $D" | ||
| 87 | echo "SAL: libdir = $libdir" | ||
| 88 | install -m 0755 -d ${D}${sysconfdir}/sysconfig ${D}${sysconfdir}/init.d | ||
| 89 | install -m 0755 ${S}/ipmi.init ${D}${sysconfdir}/init.d/ipmi | ||
| 90 | install -m 0644 ${S}/ipmi.sysconf ${D}${sysconfdir}/sysconfig/ipmi | ||
| 91 | # SAL: mv: cannot stat `/localdisk/loadbuild/slittle1/workspace/cgts_test_build/bitbake_build/tmp/work/x86_64-wrs-linux/openipmi-2.0.19-r4/image/usr/lib64/perl5': No such file or directory | ||
| 92 | # SAL: real path to perl is /localdisk/loadbuild/slittle1/workspace/cgts_test_build/bitbake_build/tmp/work/x86_64-wrs-linux/perl-5.14.2-r8.3/package/usr/lib64/perl5 and it is a symlink to perl so no need to mv. | ||
| 93 | if [ -d ${D}${libdir}/perl5 ] | ||
| 94 | then | ||
| 95 | mv ${D}${libdir}/perl5 ${D}${libdir}/perl | ||
| 96 | fi | ||
| 97 | |||
| 98 | # for systemd | ||
| 99 | install -d ${D}${systemd_unitdir}/system | ||
| 100 | install -m 0664 ${WORKDIR}/ipmi.service ${D}${systemd_unitdir}/system | ||
| 101 | sed -i -e "s,@LIBEXECDIR@,${libexecdir},g" ${D}${systemd_unitdir}/system/ipmi.service | ||
| 102 | install -d ${D}${libexecdir} | ||
| 103 | install -m 0755 ${WORKDIR}/openipmi-helper ${D}${libexecdir} | ||
| 104 | } | ||
| 105 | |||
| 106 | INITSCRIPT_NAME = "ipmi" | ||
| 107 | INITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ." | ||
| 108 | |||
| 109 | SYSTEMD_SERVICE_${PN} = "ipmi.service" | ||
| 110 | SYSTEMD_AUTO_ENABLE = "disable" | ||
