How to obtain headers for OpenWrt's kernel?

How to obtain headers for OpenWRT's kernel ?

There is a relevant Makefile at this link but I can't figure out how to use it.

define Host/Configure/all
	mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
	$(HOST_KMAKE) \
		INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
		headers_install

This is the relevant part where we can see more or less where the headers are dropped by the build system. It's a host package so it's in the build folders only, in a folder called "linux-dev" somewhere in the tree.

Looking at a compiled firmware folder (i.e. where the build dirs are populated) I think I find headers in
openwrt/build_dir/toolchain-architecture_name_here-toolchain_name/linux-dev/include/

For example this is a full path from my build folders, for a mipsel system I guess.

openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.3.0_musl/linux-dev/include/

Can you confirm if they are the headers you are looking for?

These are the .h files, which I have in this directory:

user@debian:/home/user/openwrt/build_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-7.3.0_musl_eabi/linux-dev/include# find . -type f -name "*.h"

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

That's more or less similar to the content I have on mine, and I know what "headers" are in C, those are definitely header files.

I don't know if that's enough to compile a kernel module. I never used Linux From Scratch, I don't know how to compile a kernel (or kernel module) manually.

Are these the headers after the OpenWRT's patches are applied to the vanilla kernel sources ...or before?

It does not seem to do any patching to these files, only "install" into that folder.

Another place where you find headers is (example from my build folders)

openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/linux-4.19.88/user_headers/include/

as stated in thhis part of the build system https://github.com/openwrt/openwrt/blob/master/include/kernel-defaults.mk#L107

These are the only two places you will find headers in, for each architecture/target you compile.

I don't know if they are patched or not, I guess you will have to find out by checksumming the files to see if they are different in the two folders

You can also try to ask in the mailing list or IRC chat as there is where actual OpenWrt developers mostly are.
https://openwrt.org/contact

Start with this (package/custom/devel/kernel-headers/Makefile):

include $(TOPDIR)/rules.mk

# Be sure to sync version with kernel version

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=kernel-headers
PKG_VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)
PKG_RELEASE:=1

define Package/$(PKG_NAME)
  SECTION:=devel
  CATEGORY:=Development
  TITLE:=kernel-headers (Development headers)
  DEPENDS:=+libncursesw +xz +coreutils-whoami +libelf
  URL:=http://www.kernel.org/
endef

define Package/$(PKG_NAME)/description
  kernel-headers files for development
endef

# Prepare, Configure, Compile already done by kernel depends
define Build/Prepare
endef

define Build/Configure
endef

define Build/Compile
endef

# Fails on libtinfo.so.5 dependency. Disable dependency checking

#define CheckDependencies
#endef

# Determine gcc version
GCC_VERSION:=$(call qstrip,$(CONFIG_GCC_VERSION))
# Same version as in feeds/packages/devel/gcc/Makefile
GCC_VER:=7.4.0

define Package/$(PKG_NAME)/install
        echo INSTALL_DIR: /usr/src/linux-$(LINUX_VERSION)
        echo SRC_DIR: $(LINUX_DIR)/
        echo STDARG_LOCATION: /usr/gcc-$(GCC_VER)/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VER)/include/stdarg.h
        echo STDARG_LINK: /usr/src/linux-$(LINUX_VERSION)/include/stdarg.h
        $(INSTALL_DIR) $(1)/usr/src/linux-$(LINUX_VERSION)
        cp $(LINUX_DIR)/.config $(1)/usr/src/linux-$(LINUX_VERSION)
        $(CP) $(LINUX_DIR)/* $(1)/usr/src/linux-$(LINUX_VERSION)
endef

define Package/$(PKG_NAME)/postinst
        #!/bin/sh
        # Some compiles fail without this link to stdarg.h
        ln -sf /usr/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VER)/include/stdarg.h /usr/src/linux-$(LINUX_VERSION)/include/stdarg.h
        ln -sf /usr/src/linux-$(LINUX_VERSION) /lib/modules/$(LINUX_VERSION)/build
endef

$(eval $(call BuildPackage,$(PKG_NAME)))