Tegra fails to compile Kernel Sources

Hello all.

I am trying to “make zImage” with the kernel sources directory that can be found on the Jetson TK1 software page. I have tried 19.3 and 21.2 and both fail when compiling drivers/clocksource/tegra-nvtimers.c

Here are the compiler errors:

drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_cputimer_interrupt’:
drivers/clocksource/tegra-nvtimers.c:99:25: error: dereferencing pointer to incomplete type
cpu = cpumask_first(evt->cpumask);
^
drivers/clocksource/tegra-nvtimers.c:102:5: error: dereferencing pointer to incomplete type
evt->event_handler(evt);
^
drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_cputimer_set_next_event’:
drivers/clocksource/tegra-nvtimers.c:113:25: error: dereferencing pointer to incomplete type
cpu = cpumask_first(evt->cpumask);
^
drivers/clocksource/tegra-nvtimers.c: At top level:
drivers/clocksource/tegra-nvtimers.c:122:16: warning: ‘enum clock_event_mode’ declared inside parameter list [enabled by default]
struct clock_event_device *evt)
^
drivers/clocksource/tegra-nvtimers.c:122:16: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/clocksource/tegra-nvtimers.c:121:59: error: parameter 1 (‘mode’) has incomplete type
static void tegra_cputimer_set_mode(enum clock_event_mode mode,
^
drivers/clocksource/tegra-nvtimers.c:121:13: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
static void tegra_cputimer_set_mode(enum clock_event_mode mode,
^
drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_cputimer_set_mode’:
drivers/clocksource/tegra-nvtimers.c:128:25: error: dereferencing pointer to incomplete type
cpu = cpumask_first(evt->cpumask);
^
drivers/clocksource/tegra-nvtimers.c:133:7: error: ‘CLOCK_EVT_MODE_PERIODIC’ undeclared (first use in this function)
case CLOCK_EVT_MODE_PERIODIC:
^
drivers/clocksource/tegra-nvtimers.c:133:7: note: each undeclared identifier is reported only once for each function it appears in
drivers/clocksource/tegra-nvtimers.c:137:7: error: ‘CLOCK_EVT_MODE_ONESHOT’ undeclared (first use in this function)
case CLOCK_EVT_MODE_ONESHOT:
^
drivers/clocksource/tegra-nvtimers.c:139:7: error: ‘CLOCK_EVT_MODE_UNUSED’ undeclared (first use in this function)
case CLOCK_EVT_MODE_UNUSED:
^
drivers/clocksource/tegra-nvtimers.c:140:7: error: ‘CLOCK_EVT_MODE_SHUTDOWN’ undeclared (first use in this function)
case CLOCK_EVT_MODE_SHUTDOWN:
^
drivers/clocksource/tegra-nvtimers.c:141:7: error: ‘CLOCK_EVT_MODE_RESUME’ undeclared (first use in this function)
case CLOCK_EVT_MODE_RESUME:
^
drivers/clocksource/tegra-nvtimers.c: At top level:
drivers/clocksource/tegra-nvtimers.c:146:15: error: variable ‘tegra_cputimer_clockevent’ has initializer but incomplete type
static struct clock_event_device tegra_cputimer_clockevent = {
^
drivers/clocksource/tegra-nvtimers.c:147:2: error: unknown field ‘rating’ specified in initializer
.rating = 450,
^
drivers/clocksource/tegra-nvtimers.c:147:2: warning: excess elements in struct initializer [enabled by default]
drivers/clocksource/tegra-nvtimers.c:147:2: warning: (near initialization for ‘tegra_cputimer_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:148:2: error: unknown field ‘features’ specified in initializer
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
^
drivers/clocksource/tegra-nvtimers.c:148:14: error: ‘CLOCK_EVT_FEAT_ONESHOT’ undeclared here (not in a function)
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
^
drivers/clocksource/tegra-nvtimers.c:148:39: error: ‘CLOCK_EVT_FEAT_PERIODIC’ undeclared here (not in a function)
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
^
drivers/clocksource/tegra-nvtimers.c:148:2: warning: excess elements in struct initializer [enabled by default]
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
^
drivers/clocksource/tegra-nvtimers.c:148:2: warning: (near initialization for ‘tegra_cputimer_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:149:2: error: unknown field ‘set_next_event’ specified in initializer
.set_next_event = tegra_cputimer_set_next_event,
^
drivers/clocksource/tegra-nvtimers.c:149:2: warning: excess elements in struct initializer [enabled by default]
drivers/clocksource/tegra-nvtimers.c:149:2: warning: (near initialization for ‘tegra_cputimer_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:150:2: error: unknown field ‘set_mode’ specified in initializer
.set_mode = tegra_cputimer_set_mode,
^
drivers/clocksource/tegra-nvtimers.c:150:2: warning: excess elements in struct initializer [enabled by default]
drivers/clocksource/tegra-nvtimers.c:150:2: warning: (near initialization for ‘tegra_cputimer_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:160:26: error: ‘INT_TMR3’ undeclared here (not in a function)
CPU_TIMER_IRQ_ACTION(0, INT_TMR3),
^
drivers/clocksource/tegra-nvtimers.c:157:10: note: in definition of macro ‘CPU_TIMER_IRQ_ACTION’
.irq = irqnum }
^
drivers/clocksource/tegra-nvtimers.c:182:16: warning: ‘enum clock_event_mode’ declared inside parameter list [enabled by default]
struct clock_event_device *evt)
^
drivers/clocksource/tegra-nvtimers.c:181:56: error: parameter 1 (‘mode’) has incomplete type
static void tegra_timer_set_mode(enum clock_event_mode mode,
^
drivers/clocksource/tegra-nvtimers.c:181:13: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
static void tegra_timer_set_mode(enum clock_event_mode mode,
^
drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_timer_set_mode’:
drivers/clocksource/tegra-nvtimers.c:189:7: error: ‘CLOCK_EVT_MODE_PERIODIC’ undeclared (first use in this function)
case CLOCK_EVT_MODE_PERIODIC:
^
drivers/clocksource/tegra-nvtimers.c:193:7: error: ‘CLOCK_EVT_MODE_ONESHOT’ undeclared (first use in this function)
case CLOCK_EVT_MODE_ONESHOT:
^
drivers/clocksource/tegra-nvtimers.c:195:7: error: ‘CLOCK_EVT_MODE_UNUSED’ undeclared (first use in this function)
case CLOCK_EVT_MODE_UNUSED:
^
drivers/clocksource/tegra-nvtimers.c:196:7: error: ‘CLOCK_EVT_MODE_SHUTDOWN’ undeclared (first use in this function)
case CLOCK_EVT_MODE_SHUTDOWN:
^
drivers/clocksource/tegra-nvtimers.c:197:7: error: ‘CLOCK_EVT_MODE_RESUME’ undeclared (first use in this function)
case CLOCK_EVT_MODE_RESUME:
^
drivers/clocksource/tegra-nvtimers.c: At top level:
drivers/clocksource/tegra-nvtimers.c:202:15: error: variable ‘tegra_clockevent’ has initializer but incomplete type
static struct clock_event_device tegra_clockevent = {
^
drivers/clocksource/tegra-nvtimers.c:203:2: error: unknown field ‘name’ specified in initializer
.name = “timer0”,
^
drivers/clocksource/tegra-nvtimers.c:203:2: warning: excess elements in struct initializer [enabled by default]
drivers/clocksource/tegra-nvtimers.c:203:2: warning: (near initialization for ‘tegra_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:204:2: error: unknown field ‘rating’ specified in initializer
.rating = 300,
^
drivers/clocksource/tegra-nvtimers.c:204:2: warning: excess elements in struct initializer [enabled by default]
drivers/clocksource/tegra-nvtimers.c:204:2: warning: (near initialization for ‘tegra_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:205:2: error: unknown field ‘features’ specified in initializer
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
^
drivers/clocksource/tegra-nvtimers.c:205:37: error: invalid operands to binary | (have ‘struct irqaction *’ and ‘struct irqaction *’)
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
^
drivers/clocksource/tegra-nvtimers.c:205:2: warning: excess elements in struct initializer [enabled by default]
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
^
drivers/clocksource/tegra-nvtimers.c:205:2: warning: (near initialization for ‘tegra_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:206:2: error: unknown field ‘set_next_event’ specified in initializer
.set_next_event = tegra_timer_set_next_event,
^
drivers/clocksource/tegra-nvtimers.c:206:2: warning: excess elements in struct initializer [enabled by default]
drivers/clocksource/tegra-nvtimers.c:206:2: warning: (near initialization for ‘tegra_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c:207:2: error: unknown field ‘set_mode’ specified in initializer
.set_mode = tegra_timer_set_mode,
^
drivers/clocksource/tegra-nvtimers.c:207:2: warning: excess elements in struct initializer [enabled by default]
drivers/clocksource/tegra-nvtimers.c:207:2: warning: (near initialization for ‘tegra_clockevent’) [enabled by default]
drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_timer_interrupt’:
drivers/clocksource/tegra-nvtimers.c:366:5: error: dereferencing pointer to incomplete type
evt->event_handler(evt);
^
drivers/clocksource/tegra-nvtimers.c:366:5: error: request for member ‘event_handler’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:366:20: error: called object is not a function or function pointer
evt->event_handler(evt);
^
drivers/clocksource/tegra-nvtimers.c:366:2: warning: statement with no effect [-Wunused-value]
evt->event_handler(evt);
^
drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_local_timer_setup’:
drivers/clocksource/tegra-nvtimers.c:408:5: error: dereferencing pointer to incomplete type
evt->name = clkevt->name;
^
drivers/clocksource/tegra-nvtimers.c:408:5: error: request for member ‘name’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:408:2: warning: statement with no effect [-Wunused-value]
evt->name = clkevt->name;
^
drivers/clocksource/tegra-nvtimers.c:409:5: error: dereferencing pointer to incomplete type
evt->cpumask = cpumask_of(cpu);
^
drivers/clocksource/tegra-nvtimers.c:409:5: error: request for member ‘cpumask’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:409:2: warning: statement with no effect [-Wunused-value]
evt->cpumask = cpumask_of(cpu);
^
drivers/clocksource/tegra-nvtimers.c:410:5: error: dereferencing pointer to incomplete type
evt->features = tegra_cputimer_clockevent.features;
^
drivers/clocksource/tegra-nvtimers.c:410:5: error: request for member ‘features’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:410:2: error: invalid use of undefined type ‘struct clock_event_device’
evt->features = tegra_cputimer_clockevent.features;
^
drivers/clocksource/tegra-nvtimers.c:410:2: warning: statement with no effect [-Wunused-value]
drivers/clocksource/tegra-nvtimers.c:411:5: error: dereferencing pointer to incomplete type
evt->rating = tegra_cputimer_clockevent.rating;
^
drivers/clocksource/tegra-nvtimers.c:411:5: error: request for member ‘rating’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:411:2: error: invalid use of undefined type ‘struct clock_event_device’
evt->rating = tegra_cputimer_clockevent.rating;
^
drivers/clocksource/tegra-nvtimers.c:411:2: warning: statement with no effect [-Wunused-value]
drivers/clocksource/tegra-nvtimers.c:412:5: error: dereferencing pointer to incomplete type
evt->set_mode = tegra_cputimer_set_mode;
^
drivers/clocksource/tegra-nvtimers.c:412:5: error: request for member ‘set_mode’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:412:2: warning: statement with no effect [-Wunused-value]
evt->set_mode = tegra_cputimer_set_mode;
^
drivers/clocksource/tegra-nvtimers.c:413:5: error: dereferencing pointer to incomplete type
evt->set_next_event = tegra_cputimer_set_next_event;
^
drivers/clocksource/tegra-nvtimers.c:413:5: error: request for member ‘set_next_event’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:413:2: warning: statement with no effect [-Wunused-value]
evt->set_next_event = tegra_cputimer_set_next_event;
^
drivers/clocksource/tegra-nvtimers.c:414:2: error: implicit declaration of function ‘clockevents_calc_mult_shift’ [-Werror=implicit-function-declaration]
clockevents_calc_mult_shift(evt, 1000000, 5);
^
drivers/clocksource/tegra-nvtimers.c:415:5: error: dereferencing pointer to incomplete type
evt->max_delta_ns =
^
drivers/clocksource/tegra-nvtimers.c:415:5: error: request for member ‘max_delta_ns’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:416:3: error: implicit declaration of function ‘clockevent_delta2ns’ [-Werror=implicit-function-declaration]
clockevent_delta2ns(0x1fffffff, evt);
^
drivers/clocksource/tegra-nvtimers.c:415:2: warning: statement with no effect [-Wunused-value]
evt->max_delta_ns =
^
drivers/clocksource/tegra-nvtimers.c:417:5: error: dereferencing pointer to incomplete type
evt->min_delta_ns =
^
drivers/clocksource/tegra-nvtimers.c:417:5: error: request for member ‘min_delta_ns’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:417:2: warning: statement with no effect [-Wunused-value]
evt->min_delta_ns =
^
drivers/clocksource/tegra-nvtimers.c:421:2: error: implicit declaration of function ‘clockevents_register_device’ [-Werror=implicit-function-declaration]
clockevents_register_device(evt);
^
drivers/clocksource/tegra-nvtimers.c:431:5: error: dereferencing pointer to incomplete type
evt->irq = tegra_cputimer_irq[cpu].irq;
^
drivers/clocksource/tegra-nvtimers.c:431:5: error: request for member ‘irq’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:431:2: warning: statement with no effect [-Wunused-value]
evt->irq = tegra_cputimer_irq[cpu].irq;
^
drivers/clocksource/tegra-nvtimers.c:440:23: error: dereferencing pointer to incomplete type
enable_percpu_irq(evt->irq, IRQ_TYPE_LEVEL_HIGH);
^
drivers/clocksource/tegra-nvtimers.c:440:23: error: request for member ‘irq’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:440:2: warning: passing argument 1 of ‘enable_percpu_irq’ makes integer from pointer without a cast [enabled by default]
enable_percpu_irq(evt->irq, IRQ_TYPE_LEVEL_HIGH);
^
In file included from drivers/clocksource/tegra-nvtimers.c:25:0:
include/linux/interrupt.h:221:13: note: expected ‘unsigned int’ but argument is of type ‘struct irqaction *’
extern void enable_percpu_irq(unsigned int irq, unsigned int type);
^
drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_local_timer_stop’:
drivers/clocksource/tegra-nvtimers.c:449:5: error: dereferencing pointer to incomplete type
evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
^
drivers/clocksource/tegra-nvtimers.c:449:5: error: request for member ‘set_mode’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:449:16: error: ‘CLOCK_EVT_MODE_UNUSED’ undeclared (first use in this function)
evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
^
drivers/clocksource/tegra-nvtimers.c:449:15: error: called object is not a function or function pointer
evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
^
drivers/clocksource/tegra-nvtimers.c:449:2: warning: statement with no effect [-Wunused-value]
evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
^
drivers/clocksource/tegra-nvtimers.c:450:16: error: dereferencing pointer to incomplete type
remove_irq(evt->irq, &tegra_cputimer_irq[cpu]);
^
drivers/clocksource/tegra-nvtimers.c:450:16: error: request for member ‘irq’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:450:2: warning: passing argument 1 of ‘remove_irq’ makes integer from pointer without a cast [enabled by default]
remove_irq(evt->irq, &tegra_cputimer_irq[cpu]);
^
In file included from drivers/clocksource/tegra-nvtimers.c:26:0:
include/linux/irq.h:372:13: note: expected ‘unsigned int’ but argument is of type ‘struct irqaction *’
extern void remove_irq(unsigned int irq, struct irqaction *act);
^
drivers/clocksource/tegra-nvtimers.c:451:24: error: dereferencing pointer to incomplete type
disable_percpu_irq(evt->irq);
^
drivers/clocksource/tegra-nvtimers.c:451:24: error: request for member ‘irq’ in something not a structure or union
drivers/clocksource/tegra-nvtimers.c:451:2: warning: passing argument 1 of ‘disable_percpu_irq’ makes integer from pointer without a cast [enabled by default]
disable_percpu_irq(evt->irq);
^
In file included from drivers/clocksource/tegra-nvtimers.c:25:0:
include/linux/interrupt.h:219:13: note: expected ‘unsigned int’ but argument is of type ‘struct irqaction *’
extern void disable_percpu_irq(unsigned int irq);
^
drivers/clocksource/tegra-nvtimers.c: In function ‘tegra_init_timer’:
drivers/clocksource/tegra-nvtimers.c:607:2: error: invalid use of undefined type ‘struct clock_event_device’
tegra_clockevent.max_delta_ns =
^
drivers/clocksource/tegra-nvtimers.c:607:2: warning: statement with no effect [-Wunused-value]
drivers/clocksource/tegra-nvtimers.c:609:2: error: invalid use of undefined type ‘struct clock_event_device’
tegra_clockevent.min_delta_ns =
^
drivers/clocksource/tegra-nvtimers.c:609:2: warning: statement with no effect [-Wunused-value]
drivers/clocksource/tegra-nvtimers.c:611:2: error: invalid use of undefined type ‘struct clock_event_device’
tegra_clockevent.cpumask = cpu_all_mask;
^
drivers/clocksource/tegra-nvtimers.c:611:2: warning: statement with no effect [-Wunused-value]
drivers/clocksource/tegra-nvtimers.c:612:2: error: invalid use of undefined type ‘struct clock_event_device’
tegra_clockevent.irq = tegra_timer_irq.irq;
^
drivers/clocksource/tegra-nvtimers.c:612:2: warning: statement with no effect [-Wunused-value]
cc1: some warnings being treated as errors
make[2]: *** [drivers/clocksource/tegra-nvtimers.o] Error 1
make[1]: *** [drivers/clocksource] Error 2
make: *** [drivers] Error 2

Has anyone else had this issue or know how to fix it?

It sounds like you are compiling directly on Jetson, which simplifies things. However, the answer will depend upon your config file. How does your .config differ from the stock R19.3 or R21.2? Also, is the software page you refer to the one for R19.3 or R21.2?

Thanks for the reply!

Before compiling, I would get an error that says there is no config file. Therefore, I would do sudo make menuconfig and just save it as it is.

For the software pages, I would use the one that corresponds to the version I was trying.

Ah that was the problem. I didnt copy the config file from the currently installed Image. After I did that, it worked! But now I get this error when attempting to flash it:

waiting for bootloader to initialize
bootloader downloaded successfully
file not found: boot.img
failed executing command 2147483647 NvError 0x4
partition download failed
Failed to flash ardbeg.

Ideas?

Never Mind. I just had to use sudo su.

I met the same wrong situation!

hello wangchuanyong,

according to previous comments, compiler failures should be fixed.
could you share more details about your steps, commands, and also the failure message.
thanks

Just some info, you don’t use flash to install kernels on anything using U-Boot. Which pretty much means anything the original R19.x. Kernel update under U-Boot is just a file copy, plus modules.