hello_world: Adjust header inclusions and Makefile

Currently hello_world fails to build with distro cross compiler
packages such as Debian gcc-powerpc64-linux-gnu, because it doesn't
provide string.h or unistd.h.  In fact we don't need them, we just
need stddef.h.  This adds #include <stddef.h> to console.h to get
size_t defined.  We also add #include "console.h" to console.c.

The hello_world Makefile currently hard-codes CROSS_COMPILE on
non-PPC machines.  This means that a command like:

	$ CROSS_COMPILE=powerpc64le-linux-gnu- make

doesn't do what you expect; it just tries to use powerpc64le-linux-gcc
regardless.  Adding a '?' makes it do what one expects.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
jtag-port
Paul Mackerras 5 years ago
parent d3291dbdf0
commit abefafd70b

@ -1,7 +1,7 @@
ARCH = $(shell uname -m) ARCH = $(shell uname -m)
ifneq ("$(ARCH)", "ppc64") ifneq ("$(ARCH)", "ppc64")
ifneq ("$(ARCH)", "ppc64le") ifneq ("$(ARCH)", "ppc64le")
CROSS_COMPILE = powerpc64le-linux- CROSS_COMPILE ?= powerpc64le-linux-
endif endif
endif endif



@ -1,8 +1,8 @@
#include <unistd.h>
#include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>


#include "console.h"

/* /*
* Core UART functions to implement for a port * Core UART functions to implement for a port
*/ */

@ -1,3 +1,5 @@
#include <stddef.h>

void potato_uart_init(void); void potato_uart_init(void);
int getchar(void); int getchar(void);
void putchar(unsigned char c); void putchar(unsigned char c);

@ -1,5 +1,3 @@
#include <unistd.h>
#include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>



Loading…
Cancel
Save