Commit dca377a6 authored by Tom Rini's avatar Tom Rini

kbuild: Use inttypes.h when stdint.h are not available

The following is from Jean-Christophe Dubois <jdubois@mc.com>.
On Solaris 2.8, <stdint.h> does not exist, but <inttypes.h> does.
However, on Cygwin (the other odd place that the kernel is compiled
on) <inttypes.h> doesn't exist.  So we end up testing for __sun__ and
using <inttypes.h> there, and <stdint.h> everywhere else.
Signed-off-by: default avatarTom Rini <trini@kernel.crashing.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 9a276d67
/* /*
* arch/ppc/pp3boot/mkbugboot.c * arch/ppc/boot/utils/mkbugboot.c
* *
* Makes a Motorola PPCBUG ROM bootable image which can be flashed * Makes a Motorola PPCBUG ROM bootable image which can be flashed
* into one of the FLASH banks on a Motorola PowerPlus board. * into one of the FLASH banks on a Motorola PowerPlus board.
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef __sun__
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#ifdef __i386__ #ifdef __i386__
#define cpu_to_be32(x) le32_to_cpu(x) #define cpu_to_be32(x) le32_to_cpu(x)
...@@ -49,11 +54,6 @@ unsigned short le16_to_cpu(unsigned short x) ...@@ -49,11 +54,6 @@ unsigned short le16_to_cpu(unsigned short x)
/* size of read buffer */ /* size of read buffer */
#define SIZE 0x1000 #define SIZE 0x1000
/* typedef long int32_t; */
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
/* PPCBUG ROM boot header */ /* PPCBUG ROM boot header */
typedef struct bug_boot_header { typedef struct bug_boot_header {
uint8_t magic_word[4]; /* "BOOT" */ uint8_t magic_word[4]; /* "BOOT" */
......
...@@ -15,7 +15,11 @@ ...@@ -15,7 +15,11 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <netinet/in.h> #include <netinet/in.h>
#ifdef __sun__
#include <inttypes.h>
#else
#include <stdint.h> #include <stdint.h>
#endif
/* This gets tacked on the front of the image. There are also a few /* This gets tacked on the front of the image. There are also a few
* bytes allocated after the _start label used by the boot rom (see * bytes allocated after the _start label used by the boot rom (see
......
#include <netinet/in.h> #include <netinet/in.h>
#ifdef __sun__
#include <inttypes.h>
#else
#include <stdint.h> #include <stdint.h>
#endif
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment