build: fixed some miscellaneous building errors

There are some problems on building sequence.
This patch will help to build kernel successfully.