I want to write the Linux kernel module using the KernelPatch project. The module requires the timer_list
structure placed in timer.h
. I imported header files from the Linux source using make ARCH=arm64 headers_install
there is no the required header timer.h
. How I understand this it is because the header files are for userspace programs.
The structure of files is:
headers_orig/
└── include
├── asm
│ ├── auxvec.h
│ ├── bitsperlong.h
│ ├── byteorder.h
│ ├── errno.h
│ ├── fcntl.h
│ ├── hwcap.h
│ ├── ioctl.h
│ ├── ioctls.h
│ ├── ipcbuf.h
│ ├── kvm.h
│ ├── kvm_para.h
│ ├── mman.h
│ ├── msgbuf.h
│ ├── param.h
│ ├── perf_regs.h
│ ├── poll.h
│ ├── posix_types.h
│ ├── ptrace.h
│ ├── resource.h
│ ├── sembuf.h
│ ├── setup.h
│ ├── shmbuf.h
│ ├── sigcontext.h
│ ├── siginfo.h
│ ├── signal.h
│ ├── socket.h
│ ├── sockios.h
│ ├── statfs.h
│ ├── stat.h
│ ├── swab.h
│ ├── termbits.h
│ ├── termios.h
│ ├── types.h
│ ├── ucontext.h
│ └── unistd.h
├── asm-generic
│ ├── auxvec.h
│ ├── bitsperlong.h
│ ├── errno-base.h
│ ├── errno.h
│ ├── fcntl.h
│ ├── hugetlb_encode.h
│ ├── int-l64.h
│ ├── int-ll64.h
│ ├── ioctl.h
│ ├── ioctls.h
│ ├── ipcbuf.h
│ ├── kvm_para.h
│ ├── mman-common.h
│ ├── mman.h
│ ├── msgbuf.h
│ ├── param.h
│ ├── poll.h
│ ├── posix_types.h
│ ├── resource.h
│ ├── sembuf.h
│ ├── setup.h
│ ├── shmbuf.h
│ ├── shmparam.h
│ ├── siginfo.h
│ ├── signal-defs.h
│ ├── signal.h
│ ├── socket.h
│ ├── sockios.h
│ ├── statfs.h
│ ├── stat.h
│ ├── swab.h
│ ├── termbits.h
│ ├── termios.h
│ ├── types.h
│ ├── ucontext.h
│ └── unistd.h
├── drm
│ ├── amdgpu_drm.h
│ ├── armada_drm.h
│ ├── drm_fourcc.h
│ ├── drm.h
│ ├── drm_mode.h
│ ├── drm_sarea.h
│ ├── etnaviv_drm.h
│ ├── exynos_drm.h
│ ├── i810_drm.h
│ ├── i915_drm.h
│ ├── mga_drm.h
│ ├── msm_drm.h
│ ├── nouveau_drm.h
│ ├── omap_drm.h
│ ├── qxl_drm.h
│ ├── r128_drm.h
│ ├── radeon_drm.h
│ ├── savage_drm.h
│ ├── sis_drm.h
│ ├── tegra_drm.h
│ ├── vc4_drm.h
│ ├── vgem_drm.h
│ ├── via_drm.h
│ ├── virtgpu_drm.h
│ └── vmwgfx_drm.h
├── linux
│ ├── acct.h
│ ├── adb.h
│ ├── adfs_fs.h
│ ├── affs_hardblocks.h
│ ├── agpgart.h
│ ├── aio_abi.h
│ ├── am437x-vpfe.h
│ ├── android
│ │ └── binder.h
│ ├── apm_bios.h
│ ├── arcfb.h
│ ├── aspeed-lpc-ctrl.h
│ ├── atalk.h
│ ├── atmapi.h
│ ├── atmarp.h
│ ├── atmbr2684.h
│ ├── atmclip.h
│ ├── atmdev.h
│ ├── atm_eni.h
│ ├── atm.h
│ ├── atm_he.h
│ ├── atm_idt77105.h
│ ├── atmioc.h
│ ├── atmlec.h
│ ├── atmmpc.h
│ ├── atm_nicstar.h
│ ├── atmppp.h
│ ├── atmsap.h
│ ├── atmsvc.h
│ ├── atm_tcp.h
│ ├── atm_zatm.h
│ ├── audit.h
│ ├── auto_dev-ioctl.h
│ ├── auto_fs4.h
│ ├── auto_fs.h
│ ├── auxvec.h
│ ├── ax25.h
│ ├── b1lli.h
│ ├── batman_adv.h
│ ├── baycom.h
│ ├── bcache.h
│ ├── bcm933xx_hcs.h
│ ├── bfs_fs.h
│ ├── binfmts.h
│ ├── blkpg.h
│ ├── blktrace_api.h
│ ├── blkzoned.h
│ ├── bpf_common.h
│ ├── bpf.h
│ ├── bpf_perf_event.h
│ ├── bpqether.h
│ ├── bsg.h
│ ├── bt-bmc.h
│ ├── btrfs.h
│ ├── btrfs_tree.h
│ ├── byteorder
│ │ ├── big_endian.h
│ │ └── little_endian.h
│ ├── caif
│ │ ├── caif_socket.h
│ │ └── if_caif.h
│ ├── can
│ │ ├── bcm.h
│ │ ├── error.h
│ │ ├── gw.h
│ │ ├── netlink.h
│ │ ├── raw.h
│ │ └── vxcan.h
│ ├── can.h
│ ├── capability.h
│ ├── capi.h
│ ├── cciss_defs.h
│ ├── cciss_ioctl.h
│ ├── cdrom.h
│ ├── cec-funcs.h
│ ├── cec.h
│ ├── cgroupstats.h
│ ├── chio.h
│ ├── cifs
│ │ └── cifs_mount.h
│ ├── cm4000_cs.h
│ ├── cn_proc.h
│ ├── coda.h
│ ├── coda_psdev.h
│ ├── coff.h
│ ├── connector.h
│ ├── const.h
│ ├── coresight-stm.h
│ ├── cramfs_fs.h
│ ├── cryptouser.h
│ ├── cuda.h
│ ├── cyclades.h
│ ├── cycx_cfm.h
│ ├── dcbnl.h
│ ├── dccp.h
│ ├── devlink.h
│ ├── dlmconstants.h
│ ├── dlm_device.h
│ ├── dlm.h
│ ├── dlm_netlink.h
│ ├── dlm_plock.h
│ ├── dma-buf.h
│ ├── dm-ioctl.h
│ ├── dm-log-userspace.h
│ ├── dn.h
│ ├── dqblk_xfs.h
│ ├── dvb
│ │ ├── audio.h
│ │ ├── ca.h
│ │ ├── dmx.h
│ │ ├── frontend.h
│ │ ├── net.h
│ │ ├── osd.h
│ │ ├── version.h
│ │ └── video.h
│ ├── edd.h
│ ├── efs_fs_sb.h
│ ├── elfcore.h
│ ├── elf-em.h
│ ├── elf-fdpic.h
│ ├── elf.h
│ ├── errno.h
│ ├── errqueue.h
│ ├── ethtool.h
│ ├── eventpoll.h
│ ├── fadvise.h
│ ├── falloc.h
│ ├── fanotify.h
│ ├── fb.h
│ ├── fcntl.h
│ ├── fd.h
│ ├── fdreg.h
│ ├── fib_rules.h
│ ├── fiemap.h
│ ├── filter.h
│ ├── firewire-cdev.h
│ ├── firewire-constants.h
│ ├── flat.h
│ ├── fou.h
│ ├── fs.h
│ ├── fsl_hypervisor.h
│ ├── fsmap.h
│ ├── fuse.h
│ ├── futex.h
│ ├── gameport.h
│ ├── genetlink.h
│ ├── gen_stats.h
│ ├── genwqe
│ │ └── genwqe_card.h
│ ├── gfs2_ondisk.h
│ ├── gigaset_dev.h
│ ├── gpio.h
│ ├── gsmmux.h
│ ├── gtp.h
│ ├── hash_info.h
│ ├── hdlc
│ │ └── ioctl.h
│ ├── hdlcdrv.h
│ ├── hdlc.h
│ ├── hdreg.h
│ ├── hiddev.h
│ ├── hid.h
│ ├── hidraw.h
│ ├── hpet.h
│ ├── hsi
│ │ ├── cs-protocol.h
│ │ └── hsi_char.h
│ ├── hsr_netlink.h
│ ├── hw_breakpoint.h
│ ├── hyperv.h
│ ├── hysdn_if.h
│ ├── i2c-dev.h
│ ├── i2c.h
│ ├── i2o-dev.h
│ ├── i8k.h
│ ├── icmp.h
│ ├── icmpv6.h
│ ├── if_addr.h
│ ├── if_addrlabel.h
│ ├── if_alg.h
│ ├── if_arcnet.h
│ ├── if_arp.h
│ ├── if_bonding.h
│ ├── if_bridge.h
│ ├── if_cablemodem.h
│ ├── ife.h
│ ├── if_eql.h
│ ├── if_ether.h
│ ├── if_fc.h
│ ├── if_fddi.h
│ ├── if_frad.h
│ ├── if.h
│ ├── if_hippi.h
│ ├── if_infiniband.h
│ ├── if_link.h
│ ├── if_ltalk.h
│ ├── if_macsec.h
│ ├── if_packet.h
│ ├── if_phonet.h
│ ├── if_plip.h
│ ├── if_ppp.h
│ ├── if_pppol2tp.h
│ ├── if_pppox.h
│ ├── if_slip.h
│ ├── if_team.h
│ ├── if_tun.h
│ ├── if_tunnel.h
│ ├── if_vlan.h
│ ├── if_x25.h
│ ├── igmp.h
│ ├── iio
│ │ ├── events.h
│ │ └── types.h
│ ├── ila.h
│ ├── in6.h
│ ├── inet_diag.h
│ ├── in.h
│ ├── inotify.h
│ ├── input-event-codes.h
│ ├── input.h
│ ├── in_route.h
│ ├── ioctl.h
│ ├── ip6_tunnel.h
│ ├── ipc.h
│ ├── ip.h
│ ├── ipmi.h
│ ├── ipmi_msgdefs.h
│ ├── ipsec.h
│ ├── ipv6.h
│ ├── ipv6_route.h
│ ├── ip_vs.h
│ ├── ipx.h
│ ├── irda.h
│ ├── irqnr.h
│ ├── isdn
│ │ └── capicmd.h
│ ├── isdn_divertif.h
│ ├── isdn.h
│ ├── isdnif.h
│ ├── isdn_ppp.h
│ ├── iso_fs.h
│ ├── ivtvfb.h
│ ├── ivtv.h
│ ├── ixjuser.h
│ ├── jffs2.h
│ ├── joystick.h
│ ├── kcm.h
│ ├── kcmp.h
│ ├── kcov.h
│ ├── kdev_t.h
│ ├── kd.h
│ ├── kernelcapi.h
│ ├── kernel.h
│ ├── kernel-page-flags.h
│ ├── kexec.h
│ ├── keyboard.h
│ ├── keyctl.h
│ ├── kfd_ioctl.h
│ ├── kvm.h
│ ├── l2tp.h
│ ├── libc-compat.h
│ ├── lightnvm.h
│ ├── limits.h
│ ├── lirc.h
│ ├── llc.h
│ ├── loop.h
│ ├── lp.h
│ ├── lwtunnel.h
│ ├── magic.h
│ ├── major.h
│ ├── map_to_7segment.h
│ ├── matroxfb.h
│ ├── max2175.h
│ ├── mdio.h
│ ├── media-bus-format.h
│ ├── media.h
│ ├── mei.h
│ ├── membarrier.h
│ ├── memfd.h
│ ├── mempolicy.h
│ ├── meye.h
│ ├── mic_common.h
│ ├── mic_ioctl.h
│ ├── mii.h
│ ├── minix_fs.h
│ ├── mman.h
│ ├── mmc
│ │ └── ioctl.h
│ ├── mmtimer.h
│ ├── module.h
│ ├── mpls.h
│ ├── mpls_iptunnel.h
│ ├── mqueue.h
│ ├── mroute6.h
│ ├── mroute.h
│ ├── msdos_fs.h
│ ├── msg.h
│ ├── mtio.h
│ ├── nbd.h
│ ├── nbd-netlink.h
│ ├── ncp_fs.h
│ ├── ncp.h
│ ├── ncp_mount.h
│ ├── ncp_no.h
│ ├── ndctl.h
│ ├── neighbour.h
│ ├── netconf.h
│ ├── netdevice.h
│ ├── net_dropmon.h
│ ├── netfilter
│ │ ├── ipset
│ │ │ ├── ip_set_bitmap.h
│ │ │ ├── ip_set.h
│ │ │ ├── ip_set_hash.h
│ │ │ └── ip_set_list.h
│ │ ├── nf_conntrack_common.h
│ │ ├── nf_conntrack_ftp.h
│ │ ├── nf_conntrack_sctp.h
│ │ ├── nf_conntrack_tcp.h
│ │ ├── nf_conntrack_tuple_common.h
│ │ ├── nf_log.h
│ │ ├── nf_nat.h
│ │ ├── nfnetlink_acct.h
│ │ ├── nfnetlink_compat.h
│ │ ├── nfnetlink_conntrack.h
│ │ ├── nfnetlink_cthelper.h
│ │ ├── nfnetlink_cttimeout.h
│ │ ├── nfnetlink.h
│ │ ├── nfnetlink_log.h
│ │ ├── nfnetlink_queue.h
│ │ ├── nf_tables_compat.h
│ │ ├── nf_tables.h
│ │ ├── x_tables.h
│ │ ├── xt_addrtype.h
│ │ ├── xt_AUDIT.h
│ │ ├── xt_bpf.h
│ │ ├── xt_cgroup.h
│ │ ├── xt_CHECKSUM.h
│ │ ├── xt_CLASSIFY.h
│ │ ├── xt_cluster.h
│ │ ├── xt_comment.h
│ │ ├── xt_connbytes.h
│ │ ├── xt_connlabel.h
│ │ ├── xt_connlimit.h
│ │ ├── xt_connmark.h
│ │ ├── xt_CONNMARK.h
│ │ ├── xt_CONNSECMARK.h
│ │ ├── xt_conntrack.h
│ │ ├── xt_cpu.h
│ │ ├── xt_CT.h
│ │ ├── xt_dccp.h
│ │ ├── xt_devgroup.h
│ │ ├── xt_dscp.h
│ │ ├── xt_DSCP.h
│ │ ├── xt_ecn.h
│ │ ├── xt_esp.h
│ │ ├── xt_hashlimit.h
│ │ ├── xt_helper.h
│ │ ├── xt_HMARK.h
│ │ ├── xt_IDLETIMER.h
│ │ ├── xt_ipcomp.h
│ │ ├── xt_iprange.h
│ │ ├── xt_ipvs.h
│ │ ├── xt_l2tp.h
│ │ ├── xt_LED.h
│ │ ├── xt_length.h
│ │ ├── xt_limit.h
│ │ ├── xt_LOG.h
│ │ ├── xt_mac.h
│ │ ├── xt_mark.h
│ │ ├── xt_MARK.h
│ │ ├── xt_multiport.h
│ │ ├── xt_nfacct.h
│ │ ├── xt_NFLOG.h
│ │ ├── xt_NFQUEUE.h
│ │ ├── xt_osf.h
│ │ ├── xt_owner.h
│ │ ├── xt_physdev.h
│ │ ├── xt_pkttype.h
│ │ ├── xt_policy.h
│ │ ├── xt_quota.h
│ │ ├── xt_rateest.h
│ │ ├── xt_RATEEST.h
│ │ ├── xt_realm.h
│ │ ├── xt_recent.h
│ │ ├── xt_rpfilter.h
│ │ ├── xt_sctp.h
│ │ ├── xt_SECMARK.h
│ │ ├── xt_set.h
│ │ ├── xt_socket.h
│ │ ├── xt_state.h
│ │ ├── xt_statistic.h
│ │ ├── xt_string.h
│ │ ├── xt_SYNPROXY.h
│ │ ├── xt_tcpmss.h
│ │ ├── xt_TCPMSS.h
│ │ ├── xt_TCPOPTSTRIP.h
│ │ ├── xt_tcpudp.h
│ │ ├── xt_TEE.h
│ │ ├── xt_time.h
│ │ ├── xt_TPROXY.h
│ │ └── xt_u32.h
│ ├── netfilter_arp
│ │ ├── arp_tables.h
│ │ └── arpt_mangle.h
│ ├── netfilter_arp.h
│ ├── netfilter_bridge
│ │ ├── ebt_802_3.h
│ │ ├── ebtables.h
│ │ ├── ebt_among.h
│ │ ├── ebt_arp.h
│ │ ├── ebt_arpreply.h
│ │ ├── ebt_ip6.h
│ │ ├── ebt_ip.h
│ │ ├── ebt_limit.h
│ │ ├── ebt_log.h
│ │ ├── ebt_mark_m.h
│ │ ├── ebt_mark_t.h
│ │ ├── ebt_nat.h
│ │ ├── ebt_nflog.h
│ │ ├── ebt_pkttype.h
│ │ ├── ebt_redirect.h
│ │ ├── ebt_stp.h
│ │ └── ebt_vlan.h
│ ├── netfilter_bridge.h
│ ├── netfilter_decnet.h
│ ├── netfilter.h
│ ├── netfilter_ipv4
│ │ ├── ip_tables.h
│ │ ├── ipt_ah.h
│ │ ├── ipt_CLUSTERIP.h
│ │ ├── ipt_ecn.h
│ │ ├── ipt_ECN.h
│ │ ├── ipt_LOG.h
│ │ ├── ipt_REJECT.h
│ │ ├── ipt_ttl.h
│ │ └── ipt_TTL.h
│ ├── netfilter_ipv4.h
│ ├── netfilter_ipv6
│ │ ├── ip6_tables.h
│ │ ├── ip6t_ah.h
│ │ ├── ip6t_frag.h
│ │ ├── ip6t_hl.h
│ │ ├── ip6t_HL.h
│ │ ├── ip6t_ipv6header.h
│ │ ├── ip6t_LOG.h
│ │ ├── ip6t_mh.h
│ │ ├── ip6t_NPT.h
│ │ ├── ip6t_opts.h
│ │ ├── ip6t_REJECT.h
│ │ └── ip6t_rt.h
│ ├── netfilter_ipv6.h
│ ├── net.h
│ ├── netlink_diag.h
│ ├── netlink.h
│ ├── net_namespace.h
│ ├── netrom.h
│ ├── net_tstamp.h
│ ├── nfc.h
│ ├── nfs2.h
│ ├── nfs3.h
│ ├── nfs4.h
│ ├── nfs4_mount.h
│ ├── nfsacl.h
│ ├── nfsd
│ │ ├── cld.h
│ │ ├── debug.h
│ │ ├── export.h
│ │ ├── nfsfh.h
│ │ └── stats.h
│ ├── nfs_fs.h
│ ├── nfs.h
│ ├── nfs_idmap.h
│ ├── nfs_mount.h
│ ├── nilfs2_api.h
│ ├── nilfs2_ondisk.h
│ ├── nl80211.h
│ ├── n_r3964.h
│ ├── nsfs.h
│ ├── nubus.h
│ ├── nvme_ioctl.h
│ ├── nvram.h
│ ├── omap3isp.h
│ ├── omapfb.h
│ ├── oom.h
│ ├── openvswitch.h
│ ├── packet_diag.h
│ ├── param.h
│ ├── parport.h
│ ├── patchkey.h
│ ├── pci.h
│ ├── pci_regs.h
│ ├── pcitest.h
│ ├── perf_event.h
│ ├── personality.h
│ ├── pfkeyv2.h
│ ├── pg.h
│ ├── phantom.h
│ ├── phonet.h
│ ├── pktcdvd.h
│ ├── pkt_cls.h
│ ├── pkt_sched.h
│ ├── pmu.h
│ ├── poll.h
│ ├── posix_acl.h
│ ├── posix_acl_xattr.h
│ ├── posix_types.h
│ ├── ppdev.h
│ ├── ppp-comp.h
│ ├── ppp_defs.h
│ ├── ppp-ioctl.h
│ ├── pps.h
│ ├── prctl.h
│ ├── pr.h
│ ├── psample.h
│ ├── psci.h
│ ├── ptp_clock.h
│ ├── ptrace.h
│ ├── qnx4_fs.h
│ ├── qnxtypes.h
│ ├── qrtr.h
│ ├── quota.h
│ ├── radeonfb.h
│ ├── raid
│ │ ├── md_p.h
│ │ └── md_u.h
│ ├── random.h
│ ├── raw.h
│ ├── rds.h
│ ├── reboot.h
│ ├── reiserfs_fs.h
│ ├── reiserfs_xattr.h
│ ├── resource.h
│ ├── rfkill.h
│ ├── rio_cm_cdev.h
│ ├── rio_mport_cdev.h
│ ├── romfs_fs.h
│ ├── rose.h
│ ├── route.h
│ ├── rpmsg.h
│ ├── rtc.h
│ ├── rtnetlink.h
│ ├── rxrpc.h
│ ├── scc.h
│ ├── sched
│ │ └── types.h
│ ├── sched.h
│ ├── scif_ioctl.h
│ ├── screen_info.h
│ ├── sctp.h
│ ├── sdla.h
│ ├── seccomp.h
│ ├── securebits.h
│ ├── sed-opal.h
│ ├── seg6_genl.h
│ ├── seg6.h
│ ├── seg6_hmac.h
│ ├── seg6_iptunnel.h
│ ├── seg6_local.h
│ ├── selinux_netlink.h
│ ├── sem.h
│ ├── serial_core.h
│ ├── serial.h
│ ├── serial_reg.h
│ ├── serio.h
│ ├── shm.h
│ ├── signalfd.h
│ ├── signal.h
│ ├── smc_diag.h
│ ├── smc.h
│ ├── smiapp.h
│ ├── snmp.h
│ ├── sock_diag.h
│ ├── socket.h
│ ├── sockios.h
│ ├── sonet.h
│ ├── sonypi.h
│ ├── soundcard.h
│ ├── sound.h
│ ├── spi
│ │ └── spidev.h
│ ├── stat.h
│ ├── stddef.h
│ ├── stm.h
│ ├── string.h
│ ├── sunrpc
│ │ └── debug.h
│ ├── suspend_ioctls.h
│ ├── swab.h
│ ├── switchtec_ioctl.h
│ ├── sync_file.h
│ ├── synclink.h
│ ├── sysctl.h
│ ├── sysinfo.h
│ ├── target_core_user.h
│ ├── taskstats.h
│ ├── tc_act
│ │ ├── tc_bpf.h
│ │ ├── tc_connmark.h
│ │ ├── tc_csum.h
│ │ ├── tc_defact.h
│ │ ├── tc_gact.h
│ │ ├── tc_ife.h
│ │ ├── tc_ipt.h
│ │ ├── tc_mirred.h
│ │ ├── tc_nat.h
│ │ ├── tc_pedit.h
│ │ ├── tc_sample.h
│ │ ├── tc_skbedit.h
│ │ ├── tc_skbmod.h
│ │ ├── tc_tunnel_key.h
│ │ └── tc_vlan.h
│ ├── tc_ematch
│ │ ├── tc_em_cmp.h
│ │ ├── tc_em_meta.h
│ │ ├── tc_em_nbyte.h
│ │ └── tc_em_text.h
│ ├── tcp.h
│ ├── tcp_metrics.h
│ ├── tee.h
│ ├── telephony.h
│ ├── termios.h
│ ├── thermal.h
│ ├── time.h
│ ├── timerfd.h
│ ├── times.h
│ ├── timex.h
│ ├── tiocl.h
│ ├── tipc_config.h
│ ├── tipc.h
│ ├── tipc_netlink.h
│ ├── tls.h
│ ├── toshiba.h
│ ├── tty_flags.h
│ ├── tty.h
│ ├── types.h
│ ├── udf_fs_i.h
│ ├── udp.h
│ ├── uhid.h
│ ├── uinput.h
│ ├── uio.h
│ ├── uleds.h
│ ├── ultrasound.h
│ ├── un.h
│ ├── unistd.h
│ ├── unix_diag.h
│ ├── usb
│ │ ├── audio.h
│ │ ├── cdc.h
│ │ ├── cdc-wdm.h
│ │ ├── ch11.h
│ │ ├── ch9.h
│ │ ├── charger.h
│ │ ├── functionfs.h
│ │ ├── gadgetfs.h
│ │ ├── g_printer.h
│ │ ├── midi.h
│ │ ├── tmc.h
│ │ └── video.h
│ ├── usbdevice_fs.h
│ ├── usbip.h
│ ├── userfaultfd.h
│ ├── userio.h
│ ├── utime.h
│ ├── utsname.h
│ ├── uuid.h
│ ├── uvcvideo.h
│ ├── v4l2-common.h
│ ├── v4l2-controls.h
│ ├── v4l2-dv-timings.h
│ ├── v4l2-mediabus.h
│ ├── v4l2-subdev.h
│ ├── version.h
│ ├── veth.h
│ ├── vfio_ccw.h
│ ├── vfio.h
│ ├── vhost.h
│ ├── videodev2.h
│ ├── virtio_9p.h
│ ├── virtio_balloon.h
│ ├── virtio_blk.h
│ ├── virtio_config.h
│ ├── virtio_console.h
│ ├── virtio_crypto.h
│ ├── virtio_gpu.h
│ ├── virtio_ids.h
│ ├── virtio_input.h
│ ├── virtio_mmio.h
│ ├── virtio_net.h
│ ├── virtio_pci.h
│ ├── virtio_ring.h
│ ├── virtio_rng.h
│ ├── virtio_scsi.h
│ ├── virtio_types.h
│ ├── virtio_vsock.h
│ ├── vm_sockets.h
│ ├── vsockmon.h
│ ├── vt.h
│ ├── vtpm_proxy.h
│ ├── wait.h
│ ├── wanrouter.h
│ ├── watchdog.h
│ ├── wimax
│ │ └── i2400m.h
│ ├── wimax.h
│ ├── wireless.h
│ ├── x25.h
│ ├── xattr.h
│ ├── xfrm.h
│ ├── xilinx-v4l2-controls.h
│ ├── zorro.h
│ └── zorro_ids.h
├── misc
│ └── cxl.h
├── mtd
│ ├── inftl-user.h
│ ├── mtd-abi.h
│ ├── mtd-user.h
│ ├── nftl-user.h
│ └── ubi-user.h
├── rdma
│ ├── bnxt_re-abi.h
│ ├── cxgb3-abi.h
│ ├── cxgb4-abi.h
│ ├── hfi
│ │ ├── hfi1_ioctl.h
│ │ └── hfi1_user.h
│ ├── hns-abi.h
│ ├── ib_user_cm.h
│ ├── ib_user_ioctl_verbs.h
│ ├── ib_user_mad.h
│ ├── ib_user_sa.h
│ ├── ib_user_verbs.h
│ ├── mlx4-abi.h
│ ├── mlx5-abi.h
│ ├── mthca-abi.h
│ ├── nes-abi.h
│ ├── ocrdma-abi.h
│ ├── qedr-abi.h
│ ├── rdma_netlink.h
│ ├── rdma_user_cm.h
│ ├── rdma_user_ioctl.h
│ ├── rdma_user_rxe.h
│ └── vmw_pvrdma-abi.h
├── scsi
│ ├── cxlflash_ioctl.h
│ ├── fc
│ │ ├── fc_els.h
│ │ ├── fc_fs.h
│ │ ├── fc_gs.h
│ │ └── fc_ns.h
│ ├── scsi_bsg_fc.h
│ ├── scsi_netlink_fc.h
│ └── scsi_netlink.h
├── sound
│ ├── asequencer.h
│ ├── asoc.h
│ ├── asound_fm.h
│ ├── asound.h
│ ├── compress_offload.h
│ ├── compress_params.h
│ ├── emu10k1.h
│ ├── firewire.h
│ ├── hdsp.h
│ ├── hdspm.h
│ ├── sb16_csp.h
│ ├── sfnt_info.h
│ ├── snd_sst_tokens.h
│ ├── tlv.h
│ └── usb_stream.h
├── video
│ ├── edid.h
│ ├── sisfb.h
│ └── uvesafb.h
└── xen
├── evtchn.h
├── gntalloc.h
├── gntdev.h
└── privcmd.h
I modified the Makefile using chatgpt:
# ---------------------------------------------------------------------------
# Kernel headers
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr
# If we do an all arch process set dst to include/arch-$(hdr-arch)
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
PHONY += archheaders
archheaders:
PHONY += archscripts
archscripts:
PHONY += __headers
__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
$(Q)$(MAKE) $(build)=scripts build_unifdef
PHONY += headers_install_all
headers_install_all:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
PHONY += headers_install
headers_install: __headers
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),,
$(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
# Add the following lines to include all necessary kernel headers
$(Q)$(MAKE) $(hdr-inst)=include $(hdr-dst)
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include $(hdr-dst)
PHONY += headers_check_all
headers_check_all: headers_install_all
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
PHONY += headers_check
headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) HDRCHECK=1
Orig is:
# ---------------------------------------------------------------------------
# Kernel headers
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr
# If we do an all arch process set dst to include/arch-$(hdr-arch)
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
PHONY += archheaders
archheaders:
PHONY += archscripts
archscripts:
PHONY += __headers
__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
$(Q)$(MAKE) $(build)=scripts build_unifdef
PHONY += headers_install_all
headers_install_all:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
PHONY += headers_install
headers_install: __headers
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),,
$(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
PHONY += headers_check_all
headers_check_all: headers_install_all
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
PHONY += headers_check
headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) HDRCHECK=1
Although there is timer.h
but the make
outputs an error message:
make
/home/user/Downloads/aarch64-none-elf-gcc-xpack-13.2.1-1.1/xpacks/.bin/aarch64-none-elf-gcc -I../../kernel/. -I../../kernel/include -I../../kernel/patch/include -I../../kernel/linux/include -I../../kernel/linux/arch/arm64/include -I../../kernel/linux/tools/arch/arm64/include -I../../kernel/linux-4.14.156/include -c -O2 -o secure.o secure.c
In file included from ../../kernel/linux-4.14.156/include/linux/cache.h:5,
from ../../kernel/linux-4.14.156/include/linux/time.h:5,
from ../../kernel/linux-4.14.156/include/linux/ktime.h:24,
from ../../kernel/linux-4.14.156/include/linux/timer.h:6,
from secure.c:10:
../../kernel/linux-4.14.156/include/uapi/linux/kernel.h:5:10: fatal error: linux/sysinfo.h: No such file or directory
5 | #include <linux/sysinfo.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:26: secure.o] Error 1
The sysinfo.h
is a userspace header. Why does the kerenlspacetimer.h
depend on it? How to export header files from source code for developing a linux kernel module?