This change is foundational for converting many modules that depend on kernel headers built via the platform build system. Bug: 143567008 Change-Id: I5808a8464ed30287b75baac9a74285bff5825fe2 [rishabhb@codeaurora.org: add logic to iterate over mandatory headers and only generate these headers if not already present in usr/include/asm.] Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Signed-off-by: Prateek Sood <prsood@codeaurora.org>tirimbino
parent
11ae02d078
commit
fc100c829b
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,995 @@ |
||||
// ***** DO NOT EDIT ***** |
||||
// This file is generated by kernel_headers.py |
||||
|
||||
gen_headers_arm64 = [ |
||||
|
||||
// Matching generic-y: |
||||
|
||||
"asm/errno.h", |
||||
"asm/ioctl.h", |
||||
"asm/ioctls.h", |
||||
"asm/ipcbuf.h", |
||||
"asm/kvm_para.h", |
||||
"asm/mman.h", |
||||
"asm/msgbuf.h", |
||||
"asm/poll.h", |
||||
"asm/resource.h", |
||||
"asm/sembuf.h", |
||||
"asm/shmbuf.h", |
||||
"asm/socket.h", |
||||
"asm/sockios.h", |
||||
"asm/swab.h", |
||||
"asm/termbits.h", |
||||
"asm/termios.h", |
||||
"asm/types.h", |
||||
|
||||
// From include/uapi/**/*.h |
||||
|
||||
"asm-generic/auxvec.h", |
||||
"asm-generic/bitsperlong.h", |
||||
"asm-generic/errno-base.h", |
||||
"asm-generic/errno.h", |
||||
"asm-generic/fcntl.h", |
||||
"asm-generic/hugetlb_encode.h", |
||||
"asm-generic/int-l64.h", |
||||
"asm-generic/int-ll64.h", |
||||
"asm-generic/ioctl.h", |
||||
"asm-generic/ioctls.h", |
||||
"asm-generic/ipcbuf.h", |
||||
"asm-generic/kvm_para.h", |
||||
"asm-generic/mman-common.h", |
||||
"asm-generic/mman.h", |
||||
"asm-generic/msgbuf.h", |
||||
"asm-generic/param.h", |
||||
"asm-generic/poll.h", |
||||
"asm-generic/posix_types.h", |
||||
"asm-generic/resource.h", |
||||
"asm-generic/sembuf.h", |
||||
"asm-generic/setup.h", |
||||
"asm-generic/shmbuf.h", |
||||
"asm-generic/shmparam.h", |
||||
"asm-generic/siginfo.h", |
||||
"asm-generic/signal-defs.h", |
||||
"asm-generic/signal.h", |
||||
"asm-generic/socket.h", |
||||
"asm-generic/sockios.h", |
||||
"asm-generic/stat.h", |
||||
"asm-generic/statfs.h", |
||||
"asm-generic/swab.h", |
||||
"asm-generic/termbits.h", |
||||
"asm-generic/termios.h", |
||||
"asm-generic/types.h", |
||||
"asm-generic/ucontext.h", |
||||
"asm-generic/unistd.h", |
||||
"drm/amdgpu_drm.h", |
||||
"drm/armada_drm.h", |
||||
"drm/drm.h", |
||||
"drm/drm_fourcc.h", |
||||
"drm/drm_mode.h", |
||||
"drm/drm_sarea.h", |
||||
"drm/etnaviv_drm.h", |
||||
"drm/exynos_drm.h", |
||||
"drm/i810_drm.h", |
||||
"drm/i915_drm.h", |
||||
"drm/mga_drm.h", |
||||
"drm/msm_drm.h", |
||||
"drm/msm_drm_pp.h", |
||||
"drm/nouveau_drm.h", |
||||
"drm/omap_drm.h", |
||||
"drm/qxl_drm.h", |
||||
"drm/r128_drm.h", |
||||
"drm/radeon_drm.h", |
||||
"drm/savage_drm.h", |
||||
"drm/sde_drm.h", |
||||
"drm/sis_drm.h", |
||||
"drm/tegra_drm.h", |
||||
"drm/vc4_drm.h", |
||||
"drm/vgem_drm.h", |
||||
"drm/via_drm.h", |
||||
"drm/virtgpu_drm.h", |
||||
"drm/vmwgfx_drm.h", |
||||
"linux/acct.h", |
||||
"linux/adb.h", |
||||
"linux/adfs_fs.h", |
||||
"linux/affs_hardblocks.h", |
||||
"linux/agpgart.h", |
||||
"linux/aio_abi.h", |
||||
"linux/am437x-vpfe.h", |
||||
"linux/apm_bios.h", |
||||
"linux/arcfb.h", |
||||
"linux/aspeed-lpc-ctrl.h", |
||||
"linux/atalk.h", |
||||
"linux/atm.h", |
||||
"linux/atm_eni.h", |
||||
"linux/atm_he.h", |
||||
"linux/atm_idt77105.h", |
||||
"linux/atm_nicstar.h", |
||||
"linux/atm_tcp.h", |
||||
"linux/atm_zatm.h", |
||||
"linux/atmapi.h", |
||||
"linux/atmarp.h", |
||||
"linux/atmbr2684.h", |
||||
"linux/atmclip.h", |
||||
"linux/atmdev.h", |
||||
"linux/atmioc.h", |
||||
"linux/atmlec.h", |
||||
"linux/atmmpc.h", |
||||
"linux/atmppp.h", |
||||
"linux/atmsap.h", |
||||
"linux/atmsvc.h", |
||||
"linux/audit.h", |
||||
"linux/auto_dev-ioctl.h", |
||||
"linux/auto_fs.h", |
||||
"linux/auto_fs4.h", |
||||
"linux/auxvec.h", |
||||
"linux/ax25.h", |
||||
"linux/b1lli.h", |
||||
"linux/batman_adv.h", |
||||
"linux/baycom.h", |
||||
"linux/bcache.h", |
||||
"linux/bcm933xx_hcs.h", |
||||
"linux/bfs_fs.h", |
||||
"linux/binfmts.h", |
||||
"linux/blkpg.h", |
||||
"linux/blktrace_api.h", |
||||
"linux/blkzoned.h", |
||||
"linux/bpf.h", |
||||
"linux/bpf_common.h", |
||||
"linux/bpf_perf_event.h", |
||||
"linux/bpqether.h", |
||||
"linux/bsg.h", |
||||
"linux/bt-bmc.h", |
||||
"linux/btrfs.h", |
||||
"linux/btrfs_tree.h", |
||||
"linux/can.h", |
||||
"linux/capability.h", |
||||
"linux/capi.h", |
||||
"linux/cciss_defs.h", |
||||
"linux/cciss_ioctl.h", |
||||
"linux/cdrom.h", |
||||
"linux/cec-funcs.h", |
||||
"linux/cec.h", |
||||
"linux/cgroupstats.h", |
||||
"linux/chio.h", |
||||
"linux/cm4000_cs.h", |
||||
"linux/cn_proc.h", |
||||
"linux/coda.h", |
||||
"linux/coda_psdev.h", |
||||
"linux/coff.h", |
||||
"linux/connector.h", |
||||
"linux/const.h", |
||||
"linux/coresight-stm.h", |
||||
"linux/cramfs_fs.h", |
||||
"linux/cryptouser.h", |
||||
"linux/cuda.h", |
||||
"linux/cyclades.h", |
||||
"linux/cycx_cfm.h", |
||||
"linux/dcbnl.h", |
||||
"linux/dccp.h", |
||||
"linux/devlink.h", |
||||
"linux/dlm.h", |
||||
"linux/dlm_device.h", |
||||
"linux/dlm_netlink.h", |
||||
"linux/dlm_plock.h", |
||||
"linux/dlmconstants.h", |
||||
"linux/dm-ioctl.h", |
||||
"linux/dm-log-userspace.h", |
||||
"linux/dma-buf.h", |
||||
"linux/dn.h", |
||||
"linux/dqblk_xfs.h", |
||||
"linux/edd.h", |
||||
"linux/efs_fs_sb.h", |
||||
"linux/elf-em.h", |
||||
"linux/elf-fdpic.h", |
||||
"linux/elf.h", |
||||
"linux/elfcore.h", |
||||
"linux/errno.h", |
||||
"linux/errqueue.h", |
||||
"linux/esoc_ctrl.h", |
||||
"linux/ethtool.h", |
||||
"linux/eventpoll.h", |
||||
"linux/fadvise.h", |
||||
"linux/falloc.h", |
||||
"linux/fanotify.h", |
||||
"linux/fb.h", |
||||
"linux/fcntl.h", |
||||
"linux/fd.h", |
||||
"linux/fdreg.h", |
||||
"linux/fib_rules.h", |
||||
"linux/fiemap.h", |
||||
"linux/filter.h", |
||||
"linux/fips_status.h", |
||||
"linux/firewire-cdev.h", |
||||
"linux/firewire-constants.h", |
||||
"linux/flat.h", |
||||
"linux/fou.h", |
||||
"linux/fs.h", |
||||
"linux/fsl_hypervisor.h", |
||||
"linux/fsmap.h", |
||||
"linux/fuse.h", |
||||
"linux/futex.h", |
||||
"linux/gameport.h", |
||||
"linux/gen_stats.h", |
||||
"linux/genetlink.h", |
||||
"linux/gfs2_ondisk.h", |
||||
"linux/gigaset_dev.h", |
||||
"linux/gpio.h", |
||||
"linux/gsmmux.h", |
||||
"linux/gtp.h", |
||||
"linux/hab_ioctl.h", |
||||
"linux/habmmid.h", |
||||
"linux/hash_info.h", |
||||
"linux/hbtp_input.h", |
||||
"linux/hdlc.h", |
||||
"linux/hdlcdrv.h", |
||||
"linux/hdreg.h", |
||||
"linux/hid.h", |
||||
"linux/hiddev.h", |
||||
"linux/hidraw.h", |
||||
"linux/hpet.h", |
||||
"linux/hsr_netlink.h", |
||||
"linux/hw_breakpoint.h", |
||||
"linux/hyperv.h", |
||||
"linux/hysdn_if.h", |
||||
"linux/i2c-dev.h", |
||||
"linux/i2c.h", |
||||
"linux/i2o-dev.h", |
||||
"linux/i8k.h", |
||||
"linux/icmp.h", |
||||
"linux/icmpv6.h", |
||||
"linux/if.h", |
||||
"linux/if_addr.h", |
||||
"linux/if_addrlabel.h", |
||||
"linux/if_alg.h", |
||||
"linux/if_arcnet.h", |
||||
"linux/if_arp.h", |
||||
"linux/if_bonding.h", |
||||
"linux/if_bridge.h", |
||||
"linux/if_cablemodem.h", |
||||
"linux/if_eql.h", |
||||
"linux/if_ether.h", |
||||
"linux/if_fc.h", |
||||
"linux/if_fddi.h", |
||||
"linux/if_frad.h", |
||||
"linux/if_hippi.h", |
||||
"linux/if_infiniband.h", |
||||
"linux/if_link.h", |
||||
"linux/if_ltalk.h", |
||||
"linux/if_macsec.h", |
||||
"linux/if_packet.h", |
||||
"linux/if_phonet.h", |
||||
"linux/if_plip.h", |
||||
"linux/if_ppp.h", |
||||
"linux/if_pppol2tp.h", |
||||
"linux/if_pppolac.h", |
||||
"linux/if_pppopns.h", |
||||
"linux/if_pppox.h", |
||||
"linux/if_slip.h", |
||||
"linux/if_team.h", |
||||
"linux/if_tun.h", |
||||
"linux/if_tunnel.h", |
||||
"linux/if_vlan.h", |
||||
"linux/if_x25.h", |
||||
"linux/ife.h", |
||||
"linux/igmp.h", |
||||
"linux/ila.h", |
||||
"linux/in.h", |
||||
"linux/in6.h", |
||||
"linux/in_route.h", |
||||
"linux/inet_diag.h", |
||||
"linux/inotify.h", |
||||
"linux/input-event-codes.h", |
||||
"linux/input.h", |
||||
"linux/ioctl.h", |
||||
"linux/ion.h", |
||||
"linux/ip.h", |
||||
"linux/ip6_tunnel.h", |
||||
"linux/ip_vs.h", |
||||
"linux/ipa_qmi_service_v01.h", |
||||
"linux/ipc.h", |
||||
"linux/ipmi.h", |
||||
"linux/ipmi_msgdefs.h", |
||||
"linux/ipsec.h", |
||||
"linux/ipv6.h", |
||||
"linux/ipv6_route.h", |
||||
"linux/ipx.h", |
||||
"linux/irda.h", |
||||
"linux/irqnr.h", |
||||
"linux/isdn.h", |
||||
"linux/isdn_divertif.h", |
||||
"linux/isdn_ppp.h", |
||||
"linux/isdnif.h", |
||||
"linux/iso_fs.h", |
||||
"linux/ivtv.h", |
||||
"linux/ivtvfb.h", |
||||
"linux/ixjuser.h", |
||||
"linux/jffs2.h", |
||||
"linux/joystick.h", |
||||
"linux/kcm.h", |
||||
"linux/kcmp.h", |
||||
"linux/kcov.h", |
||||
"linux/kd.h", |
||||
"linux/kdev_t.h", |
||||
"linux/kernel-page-flags.h", |
||||
"linux/kernel.h", |
||||
"linux/kernelcapi.h", |
||||
"linux/kexec.h", |
||||
"linux/keyboard.h", |
||||
"linux/keyctl.h", |
||||
"linux/kfd_ioctl.h", |
||||
"linux/kvm.h", |
||||
"linux/l2tp.h", |
||||
"linux/libc-compat.h", |
||||
"linux/lightnvm.h", |
||||
"linux/limits.h", |
||||
"linux/lirc.h", |
||||
"linux/llc.h", |
||||
"linux/loop.h", |
||||
"linux/lp.h", |
||||
"linux/lwtunnel.h", |
||||
"linux/magic.h", |
||||
"linux/major.h", |
||||
"linux/map_to_7segment.h", |
||||
"linux/matroxfb.h", |
||||
"linux/max2175.h", |
||||
"linux/mdio.h", |
||||
"linux/mdss_rotator.h", |
||||
"linux/media-bus-format.h", |
||||
"linux/media.h", |
||||
"linux/mei.h", |
||||
"linux/membarrier.h", |
||||
"linux/memfd.h", |
||||
"linux/mempolicy.h", |
||||
"linux/meye.h", |
||||
"linux/mhi.h", |
||||
"linux/mic_common.h", |
||||
"linux/mic_ioctl.h", |
||||
"linux/mii.h", |
||||
"linux/minix_fs.h", |
||||
"linux/mman.h", |
||||
"linux/mmtimer.h", |
||||
"linux/module.h", |
||||
"linux/mpls.h", |
||||
"linux/mpls_iptunnel.h", |
||||
"linux/mqueue.h", |
||||
"linux/mroute.h", |
||||
"linux/mroute6.h", |
||||
"linux/msdos_fs.h", |
||||
"linux/msg.h", |
||||
"linux/msm_dsps.h", |
||||
"linux/msm_ion.h", |
||||
"linux/msm_ipa.h", |
||||
"linux/msm_kgsl.h", |
||||
"linux/msm_mdp.h", |
||||
"linux/msm_mdp_ext.h", |
||||
"linux/msm_npu.h", |
||||
"linux/msm_rmnet.h", |
||||
"linux/msm_rotator.h", |
||||
"linux/mtio.h", |
||||
"linux/n_r3964.h", |
||||
"linux/nbd-netlink.h", |
||||
"linux/nbd.h", |
||||
"linux/ncp.h", |
||||
"linux/ncp_fs.h", |
||||
"linux/ncp_mount.h", |
||||
"linux/ncp_no.h", |
||||
"linux/ndctl.h", |
||||
"linux/neighbour.h", |
||||
"linux/net.h", |
||||
"linux/net_dropmon.h", |
||||
"linux/net_map.h", |
||||
"linux/net_namespace.h", |
||||
"linux/net_tstamp.h", |
||||
"linux/netconf.h", |
||||
"linux/netdevice.h", |
||||
"linux/netfilter.h", |
||||
"linux/netfilter_arp.h", |
||||
"linux/netfilter_bridge.h", |
||||
"linux/netfilter_decnet.h", |
||||
"linux/netfilter_ipv4.h", |
||||
"linux/netfilter_ipv6.h", |
||||
"linux/netlink.h", |
||||
"linux/netlink_diag.h", |
||||
"linux/netrom.h", |
||||
"linux/nfc.h", |
||||
"linux/nfs.h", |
||||
"linux/nfs2.h", |
||||
"linux/nfs3.h", |
||||
"linux/nfs4.h", |
||||
"linux/nfs4_mount.h", |
||||
"linux/nfs_fs.h", |
||||
"linux/nfs_idmap.h", |
||||
"linux/nfs_mount.h", |
||||
"linux/nfsacl.h", |
||||
"linux/nilfs2_api.h", |
||||
"linux/nilfs2_ondisk.h", |
||||
"linux/nl80211.h", |
||||
"linux/nsfs.h", |
||||
"linux/nubus.h", |
||||
"linux/nvme_ioctl.h", |
||||
"linux/nvram.h", |
||||
"linux/okl4-link-shbuf.h", |
||||
"linux/okl4-vipc.h", |
||||
"linux/omap3isp.h", |
||||
"linux/omapfb.h", |
||||
"linux/oom.h", |
||||
"linux/openvswitch.h", |
||||
"linux/packet_diag.h", |
||||
"linux/param.h", |
||||
"linux/parport.h", |
||||
"linux/patchkey.h", |
||||
"linux/pci.h", |
||||
"linux/pci_regs.h", |
||||
"linux/pcitest.h", |
||||
"linux/perf_event.h", |
||||
"linux/personality.h", |
||||
"linux/pfkeyv2.h", |
||||
"linux/pg.h", |
||||
"linux/phantom.h", |
||||
"linux/phonet.h", |
||||
"linux/pkt_cls.h", |
||||
"linux/pkt_sched.h", |
||||
"linux/pktcdvd.h", |
||||
"linux/pmu.h", |
||||
"linux/poll.h", |
||||
"linux/posix_acl.h", |
||||
"linux/posix_acl_xattr.h", |
||||
"linux/posix_types.h", |
||||
"linux/ppdev.h", |
||||
"linux/ppp-comp.h", |
||||
"linux/ppp-ioctl.h", |
||||
"linux/ppp_defs.h", |
||||
"linux/pps.h", |
||||
"linux/pr.h", |
||||
"linux/prctl.h", |
||||
"linux/psample.h", |
||||
"linux/psci.h", |
||||
"linux/ptp_clock.h", |
||||
"linux/ptrace.h", |
||||
"linux/qbt1000.h", |
||||
"linux/qcedev.h", |
||||
"linux/qcota.h", |
||||
"linux/qg-profile.h", |
||||
"linux/qg.h", |
||||
"linux/qnx4_fs.h", |
||||
"linux/qnxtypes.h", |
||||
"linux/qrng.h", |
||||
"linux/qrtr.h", |
||||
"linux/qseecom.h", |
||||
"linux/quota.h", |
||||
"linux/radeonfb.h", |
||||
"linux/random.h", |
||||
"linux/raw.h", |
||||
"linux/rds.h", |
||||
"linux/reboot.h", |
||||
"linux/reiserfs_fs.h", |
||||
"linux/reiserfs_xattr.h", |
||||
"linux/resource.h", |
||||
"linux/rfkill.h", |
||||
"linux/rio_cm_cdev.h", |
||||
"linux/rio_mport_cdev.h", |
||||
"linux/rmnet_data.h", |
||||
"linux/rmnet_ipa_fd_ioctl.h", |
||||
"linux/romfs_fs.h", |
||||
"linux/rose.h", |
||||
"linux/route.h", |
||||
"linux/rpmsg.h", |
||||
"linux/rtc.h", |
||||
"linux/rtnetlink.h", |
||||
"linux/rxrpc.h", |
||||
"linux/scc.h", |
||||
"linux/sched.h", |
||||
"linux/scif_ioctl.h", |
||||
"linux/screen_info.h", |
||||
"linux/sctp.h", |
||||
"linux/sdla.h", |
||||
"linux/seccomp.h", |
||||
"linux/securebits.h", |
||||
"linux/sed-opal.h", |
||||
"linux/seemp_api.h", |
||||
"linux/seemp_param_id.h", |
||||
"linux/seg6.h", |
||||
"linux/seg6_genl.h", |
||||
"linux/seg6_hmac.h", |
||||
"linux/seg6_iptunnel.h", |
||||
"linux/seg6_local.h", |
||||
"linux/selinux_netlink.h", |
||||
"linux/sem.h", |
||||
"linux/serial.h", |
||||
"linux/serial_core.h", |
||||
"linux/serial_reg.h", |
||||
"linux/serio.h", |
||||
"linux/shm.h", |
||||
"linux/signal.h", |
||||
"linux/signalfd.h", |
||||
"linux/smc.h", |
||||
"linux/smc_diag.h", |
||||
"linux/smcinvoke.h", |
||||
"linux/smiapp.h", |
||||
"linux/snmp.h", |
||||
"linux/sock_diag.h", |
||||
"linux/socket.h", |
||||
"linux/sockev.h", |
||||
"linux/sockios.h", |
||||
"linux/sonet.h", |
||||
"linux/sonypi.h", |
||||
"linux/sound.h", |
||||
"linux/soundcard.h", |
||||
"linux/spcom.h", |
||||
"linux/stat.h", |
||||
"linux/stddef.h", |
||||
"linux/stm.h", |
||||
"linux/string.h", |
||||
"linux/suspend_ioctls.h", |
||||
"linux/swab.h", |
||||
"linux/switchtec_ioctl.h", |
||||
"linux/sync_file.h", |
||||
"linux/synclink.h", |
||||
"linux/sysctl.h", |
||||
"linux/sysinfo.h", |
||||
"linux/sysstats.h", |
||||
"linux/target_core_user.h", |
||||
"linux/taskstats.h", |
||||
"linux/tcp.h", |
||||
"linux/tcp_metrics.h", |
||||
"linux/tee.h", |
||||
"linux/telephony.h", |
||||
"linux/termios.h", |
||||
"linux/thermal.h", |
||||
"linux/time.h", |
||||
"linux/timerfd.h", |
||||
"linux/times.h", |
||||
"linux/timex.h", |
||||
"linux/tiocl.h", |
||||
"linux/tipc.h", |
||||
"linux/tipc_config.h", |
||||
"linux/tipc_netlink.h", |
||||
"linux/tls.h", |
||||
"linux/toshiba.h", |
||||
"linux/tty.h", |
||||
"linux/tty_flags.h", |
||||
"linux/types.h", |
||||
"linux/udf_fs_i.h", |
||||
"linux/udp.h", |
||||
"linux/uhid.h", |
||||
"linux/uinput.h", |
||||
"linux/uio.h", |
||||
"linux/uleds.h", |
||||
"linux/ultrasound.h", |
||||
"linux/un.h", |
||||
"linux/unistd.h", |
||||
"linux/unix_diag.h", |
||||
"linux/usbdevice_fs.h", |
||||
"linux/usbip.h", |
||||
"linux/userfaultfd.h", |
||||
"linux/userio.h", |
||||
"linux/utime.h", |
||||
"linux/utsname.h", |
||||
"linux/uuid.h", |
||||
"linux/uvcvideo.h", |
||||
"linux/v4l2-common.h", |
||||
"linux/v4l2-controls.h", |
||||
"linux/v4l2-dv-timings.h", |
||||
"linux/v4l2-mediabus.h", |
||||
"linux/v4l2-subdev.h", |
||||
"linux/veth.h", |
||||
"linux/vfio.h", |
||||
"linux/vfio_ccw.h", |
||||
"linux/vhost.h", |
||||
"linux/videodev2.h", |
||||
"linux/virtio_9p.h", |
||||
"linux/virtio_balloon.h", |
||||
"linux/virtio_blk.h", |
||||
"linux/virtio_config.h", |
||||
"linux/virtio_console.h", |
||||
"linux/virtio_crypto.h", |
||||
"linux/virtio_gpu.h", |
||||
"linux/virtio_ids.h", |
||||
"linux/virtio_input.h", |
||||
"linux/virtio_mmio.h", |
||||
"linux/virtio_net.h", |
||||
"linux/virtio_pci.h", |
||||
"linux/virtio_ring.h", |
||||
"linux/virtio_rng.h", |
||||
"linux/virtio_scsi.h", |
||||
"linux/virtio_types.h", |
||||
"linux/virtio_vsock.h", |
||||
"linux/vm_sockets.h", |
||||
"linux/vsockmon.h", |
||||
"linux/vt.h", |
||||
"linux/vtpm_proxy.h", |
||||
"linux/wait.h", |
||||
"linux/wanrouter.h", |
||||
"linux/watchdog.h", |
||||
"linux/wil6210_uapi.h", |
||||
"linux/wimax.h", |
||||
"linux/wireless.h", |
||||
"linux/x25.h", |
||||
"linux/xattr.h", |
||||
"linux/xfrm.h", |
||||
"linux/xilinx-v4l2-controls.h", |
||||
"linux/zorro.h", |
||||
"linux/zorro_ids.h", |
||||
"media/ais_sensor.h", |
||||
"media/cam_cpas.h", |
||||
"media/cam_defs.h", |
||||
"media/cam_fd.h", |
||||
"media/cam_hyp_intf.h", |
||||
"media/cam_icp.h", |
||||
"media/cam_isp.h", |
||||
"media/cam_isp_ife.h", |
||||
"media/cam_isp_vfe.h", |
||||
"media/cam_jpeg.h", |
||||
"media/cam_lrme.h", |
||||
"media/cam_req_mgr.h", |
||||
"media/cam_sensor.h", |
||||
"media/cam_sync.h", |
||||
"media/msm_cam_sensor.h", |
||||
"media/msm_camera.h", |
||||
"media/msm_camsensor_sdk.h", |
||||
"media/msm_fd.h", |
||||
"media/msm_isp.h", |
||||
"media/msm_jpeg.h", |
||||
"media/msm_jpeg_dma.h", |
||||
"media/msm_media_info.h", |
||||
"media/msm_sde_rotator.h", |
||||
"media/msm_vidc.h", |
||||
"media/msm_vidc_private.h", |
||||
"media/msm_vidc_utils.h", |
||||
"media/msmb_camera.h", |
||||
"media/msmb_generic_buf_mgr.h", |
||||
"media/msmb_isp.h", |
||||
"media/msmb_ispif.h", |
||||
"media/msmb_pproc.h", |
||||
"media/radio-iris-commands.h", |
||||
"media/radio-iris.h", |
||||
"misc/cxl.h", |
||||
"mtd/inftl-user.h", |
||||
"mtd/mtd-abi.h", |
||||
"mtd/mtd-user.h", |
||||
"mtd/nftl-user.h", |
||||
"mtd/ubi-user.h", |
||||
"rdma/bnxt_re-abi.h", |
||||
"rdma/cxgb3-abi.h", |
||||
"rdma/cxgb4-abi.h", |
||||
"rdma/hns-abi.h", |
||||
"rdma/ib_user_cm.h", |
||||
"rdma/ib_user_ioctl_verbs.h", |
||||
"rdma/ib_user_mad.h", |
||||
"rdma/ib_user_sa.h", |
||||
"rdma/ib_user_verbs.h", |
||||
"rdma/mlx4-abi.h", |
||||
"rdma/mlx5-abi.h", |
||||
"rdma/mthca-abi.h", |
||||
"rdma/nes-abi.h", |
||||
"rdma/ocrdma-abi.h", |
||||
"rdma/qedr-abi.h", |
||||
"rdma/rdma_netlink.h", |
||||
"rdma/rdma_user_cm.h", |
||||
"rdma/rdma_user_ioctl.h", |
||||
"rdma/rdma_user_rxe.h", |
||||
"rdma/vmw_pvrdma-abi.h", |
||||
"scsi/cxlflash_ioctl.h", |
||||
"scsi/scsi_bsg_fc.h", |
||||
"scsi/scsi_ioctl.h", |
||||
"scsi/scsi_netlink.h", |
||||
"scsi/scsi_netlink_fc.h", |
||||
"scsi/sg.h", |
||||
"sound/asequencer.h", |
||||
"sound/asoc.h", |
||||
"sound/asound.h", |
||||
"sound/asound_fm.h", |
||||
"sound/compress_offload.h", |
||||
"sound/compress_params.h", |
||||
"sound/emu10k1.h", |
||||
"sound/firewire.h", |
||||
"sound/hdsp.h", |
||||
"sound/hdspm.h", |
||||
"sound/sb16_csp.h", |
||||
"sound/sfnt_info.h", |
||||
"sound/snd_sst_tokens.h", |
||||
"sound/tlv.h", |
||||
"sound/usb_stream.h", |
||||
"video/edid.h", |
||||
"video/msm_hdmi_hdcp_mgr.h", |
||||
"video/msm_hdmi_modes.h", |
||||
"video/sisfb.h", |
||||
"video/uvesafb.h", |
||||
"xen/evtchn.h", |
||||
"xen/gntalloc.h", |
||||
"xen/gntdev.h", |
||||
"xen/privcmd.h", |
||||
"linux/android/binder.h", |
||||
"linux/byteorder/big_endian.h", |
||||
"linux/byteorder/little_endian.h", |
||||
"linux/caif/caif_socket.h", |
||||
"linux/caif/if_caif.h", |
||||
"linux/can/bcm.h", |
||||
"linux/can/error.h", |
||||
"linux/can/gw.h", |
||||
"linux/can/netlink.h", |
||||
"linux/can/raw.h", |
||||
"linux/can/vxcan.h", |
||||
"linux/cifs/cifs_mount.h", |
||||
"linux/dvb/audio.h", |
||||
"linux/dvb/ca.h", |
||||
"linux/dvb/dmx.h", |
||||
"linux/dvb/frontend.h", |
||||
"linux/dvb/net.h", |
||||
"linux/dvb/osd.h", |
||||
"linux/dvb/version.h", |
||||
"linux/dvb/video.h", |
||||
"linux/genwqe/genwqe_card.h", |
||||
"linux/hdlc/ioctl.h", |
||||
"linux/hsi/cs-protocol.h", |
||||
"linux/hsi/hsi_char.h", |
||||
"linux/iio/events.h", |
||||
"linux/iio/types.h", |
||||
"linux/isdn/capicmd.h", |
||||
"linux/mmc/core.h", |
||||
"linux/mmc/ioctl.h", |
||||
"linux/mmc/mmc.h", |
||||
"linux/netfilter/nf_conntrack_common.h", |
||||
"linux/netfilter/nf_conntrack_ftp.h", |
||||
"linux/netfilter/nf_conntrack_sctp.h", |
||||
"linux/netfilter/nf_conntrack_tcp.h", |
||||
"linux/netfilter/nf_conntrack_tuple_common.h", |
||||
"linux/netfilter/nf_log.h", |
||||
"linux/netfilter/nf_nat.h", |
||||
"linux/netfilter/nf_tables.h", |
||||
"linux/netfilter/nf_tables_compat.h", |
||||
"linux/netfilter/nfnetlink.h", |
||||
"linux/netfilter/nfnetlink_acct.h", |
||||
"linux/netfilter/nfnetlink_compat.h", |
||||
"linux/netfilter/nfnetlink_conntrack.h", |
||||
"linux/netfilter/nfnetlink_cthelper.h", |
||||
"linux/netfilter/nfnetlink_cttimeout.h", |
||||
"linux/netfilter/nfnetlink_log.h", |
||||
"linux/netfilter/nfnetlink_queue.h", |
||||
"linux/netfilter/x_tables.h", |
||||
"linux/netfilter/xt_AUDIT.h", |
||||
"linux/netfilter/xt_CHECKSUM.h", |
||||
"linux/netfilter/xt_CLASSIFY.h", |
||||
"linux/netfilter/xt_CONNMARK.h", |
||||
"linux/netfilter/xt_CONNSECMARK.h", |
||||
"linux/netfilter/xt_CT.h", |
||||
"linux/netfilter/xt_DSCP.h", |
||||
"linux/netfilter/xt_HARDIDLETIMER.h", |
||||
"linux/netfilter/xt_HMARK.h", |
||||
"linux/netfilter/xt_IDLETIMER.h", |
||||
"linux/netfilter/xt_LED.h", |
||||
"linux/netfilter/xt_LOG.h", |
||||
"linux/netfilter/xt_MARK.h", |
||||
"linux/netfilter/xt_NFLOG.h", |
||||
"linux/netfilter/xt_NFQUEUE.h", |
||||
"linux/netfilter/xt_RATEEST.h", |
||||
"linux/netfilter/xt_SECMARK.h", |
||||
"linux/netfilter/xt_SYNPROXY.h", |
||||
"linux/netfilter/xt_TCPMSS.h", |
||||
"linux/netfilter/xt_TCPOPTSTRIP.h", |
||||
"linux/netfilter/xt_TEE.h", |
||||
"linux/netfilter/xt_TPROXY.h", |
||||
"linux/netfilter/xt_addrtype.h", |
||||
"linux/netfilter/xt_bpf.h", |
||||
"linux/netfilter/xt_cgroup.h", |
||||
"linux/netfilter/xt_cluster.h", |
||||
"linux/netfilter/xt_comment.h", |
||||
"linux/netfilter/xt_connbytes.h", |
||||
"linux/netfilter/xt_connlabel.h", |
||||
"linux/netfilter/xt_connlimit.h", |
||||
"linux/netfilter/xt_connmark.h", |
||||
"linux/netfilter/xt_conntrack.h", |
||||
"linux/netfilter/xt_cpu.h", |
||||
"linux/netfilter/xt_dccp.h", |
||||
"linux/netfilter/xt_devgroup.h", |
||||
"linux/netfilter/xt_dscp.h", |
||||
"linux/netfilter/xt_ecn.h", |
||||
"linux/netfilter/xt_esp.h", |
||||
"linux/netfilter/xt_hashlimit.h", |
||||
"linux/netfilter/xt_helper.h", |
||||
"linux/netfilter/xt_ipcomp.h", |
||||
"linux/netfilter/xt_iprange.h", |
||||
"linux/netfilter/xt_ipvs.h", |
||||
"linux/netfilter/xt_l2tp.h", |
||||
"linux/netfilter/xt_length.h", |
||||
"linux/netfilter/xt_limit.h", |
||||
"linux/netfilter/xt_mac.h", |
||||
"linux/netfilter/xt_mark.h", |
||||
"linux/netfilter/xt_multiport.h", |
||||
"linux/netfilter/xt_nfacct.h", |
||||
"linux/netfilter/xt_osf.h", |
||||
"linux/netfilter/xt_owner.h", |
||||
"linux/netfilter/xt_physdev.h", |
||||
"linux/netfilter/xt_pkttype.h", |
||||
"linux/netfilter/xt_policy.h", |
||||
"linux/netfilter/xt_quota.h", |
||||
"linux/netfilter/xt_rateest.h", |
||||
"linux/netfilter/xt_realm.h", |
||||
"linux/netfilter/xt_recent.h", |
||||
"linux/netfilter/xt_rpfilter.h", |
||||
"linux/netfilter/xt_sctp.h", |
||||
"linux/netfilter/xt_set.h", |
||||
"linux/netfilter/xt_socket.h", |
||||
"linux/netfilter/xt_state.h", |
||||
"linux/netfilter/xt_statistic.h", |
||||
"linux/netfilter/xt_string.h", |
||||
"linux/netfilter/xt_tcpmss.h", |
||||
"linux/netfilter/xt_tcpudp.h", |
||||
"linux/netfilter/xt_time.h", |
||||
"linux/netfilter/xt_u32.h", |
||||
"linux/netfilter_arp/arp_tables.h", |
||||
"linux/netfilter_arp/arpt_mangle.h", |
||||
"linux/netfilter_bridge/ebt_802_3.h", |
||||
"linux/netfilter_bridge/ebt_among.h", |
||||
"linux/netfilter_bridge/ebt_arp.h", |
||||
"linux/netfilter_bridge/ebt_arpreply.h", |
||||
"linux/netfilter_bridge/ebt_ip.h", |
||||
"linux/netfilter_bridge/ebt_ip6.h", |
||||
"linux/netfilter_bridge/ebt_limit.h", |
||||
"linux/netfilter_bridge/ebt_log.h", |
||||
"linux/netfilter_bridge/ebt_mark_m.h", |
||||
"linux/netfilter_bridge/ebt_mark_t.h", |
||||
"linux/netfilter_bridge/ebt_nat.h", |
||||
"linux/netfilter_bridge/ebt_nflog.h", |
||||
"linux/netfilter_bridge/ebt_pkttype.h", |
||||
"linux/netfilter_bridge/ebt_redirect.h", |
||||
"linux/netfilter_bridge/ebt_stp.h", |
||||
"linux/netfilter_bridge/ebt_vlan.h", |
||||
"linux/netfilter_bridge/ebtables.h", |
||||
"linux/netfilter_ipv4/ip_tables.h", |
||||
"linux/netfilter_ipv4/ipt_CLUSTERIP.h", |
||||
"linux/netfilter_ipv4/ipt_ECN.h", |
||||
"linux/netfilter_ipv4/ipt_LOG.h", |
||||
"linux/netfilter_ipv4/ipt_NATTYPE.h", |
||||
"linux/netfilter_ipv4/ipt_REJECT.h", |
||||
"linux/netfilter_ipv4/ipt_TTL.h", |
||||
"linux/netfilter_ipv4/ipt_ah.h", |
||||
"linux/netfilter_ipv4/ipt_ecn.h", |
||||
"linux/netfilter_ipv4/ipt_ttl.h", |
||||
"linux/netfilter_ipv6/ip6_tables.h", |
||||
"linux/netfilter_ipv6/ip6t_HL.h", |
||||
"linux/netfilter_ipv6/ip6t_LOG.h", |
||||
"linux/netfilter_ipv6/ip6t_NPT.h", |
||||
"linux/netfilter_ipv6/ip6t_REJECT.h", |
||||
"linux/netfilter_ipv6/ip6t_ah.h", |
||||
"linux/netfilter_ipv6/ip6t_frag.h", |
||||
"linux/netfilter_ipv6/ip6t_hl.h", |
||||
"linux/netfilter_ipv6/ip6t_ipv6header.h", |
||||
"linux/netfilter_ipv6/ip6t_mh.h", |
||||
"linux/netfilter_ipv6/ip6t_opts.h", |
||||
"linux/netfilter_ipv6/ip6t_rt.h", |
||||
"linux/nfc/nfcinfo.h", |
||||
"linux/nfc/ntaginfo.h", |
||||
"linux/nfsd/cld.h", |
||||
"linux/nfsd/debug.h", |
||||
"linux/nfsd/export.h", |
||||
"linux/nfsd/nfsfh.h", |
||||
"linux/nfsd/stats.h", |
||||
"linux/raid/md_p.h", |
||||
"linux/raid/md_u.h", |
||||
"linux/sched/types.h", |
||||
"linux/spi/spidev.h", |
||||
"linux/sunrpc/debug.h", |
||||
"linux/tc_act/tc_bpf.h", |
||||
"linux/tc_act/tc_connmark.h", |
||||
"linux/tc_act/tc_csum.h", |
||||
"linux/tc_act/tc_defact.h", |
||||
"linux/tc_act/tc_gact.h", |
||||
"linux/tc_act/tc_ife.h", |
||||
"linux/tc_act/tc_ipt.h", |
||||
"linux/tc_act/tc_mirred.h", |
||||
"linux/tc_act/tc_nat.h", |
||||
"linux/tc_act/tc_pedit.h", |
||||
"linux/tc_act/tc_sample.h", |
||||
"linux/tc_act/tc_skbedit.h", |
||||
"linux/tc_act/tc_skbmod.h", |
||||
"linux/tc_act/tc_tunnel_key.h", |
||||
"linux/tc_act/tc_vlan.h", |
||||
"linux/tc_ematch/tc_em_cmp.h", |
||||
"linux/tc_ematch/tc_em_meta.h", |
||||
"linux/tc_ematch/tc_em_nbyte.h", |
||||
"linux/tc_ematch/tc_em_text.h", |
||||
"linux/usb/audio.h", |
||||
"linux/usb/cdc-wdm.h", |
||||
"linux/usb/cdc.h", |
||||
"linux/usb/ch11.h", |
||||
"linux/usb/ch9.h", |
||||
"linux/usb/charger.h", |
||||
"linux/usb/f_accessory.h", |
||||
"linux/usb/f_mtp.h", |
||||
"linux/usb/functionfs.h", |
||||
"linux/usb/g_printer.h", |
||||
"linux/usb/gadgetfs.h", |
||||
"linux/usb/midi.h", |
||||
"linux/usb/tmc.h", |
||||
"linux/usb/usb_ctrl_qti.h", |
||||
"linux/usb/video.h", |
||||
"linux/wimax/i2400m.h", |
||||
"rdma/hfi/hfi1_ioctl.h", |
||||
"rdma/hfi/hfi1_user.h", |
||||
"scsi/fc/fc_els.h", |
||||
"scsi/fc/fc_fs.h", |
||||
"scsi/fc/fc_gs.h", |
||||
"scsi/fc/fc_ns.h", |
||||
"scsi/ufs/ioctl.h", |
||||
"scsi/ufs/ufs.h", |
||||
"linux/netfilter/ipset/ip_set.h", |
||||
"linux/netfilter/ipset/ip_set_bitmap.h", |
||||
"linux/netfilter/ipset/ip_set_hash.h", |
||||
"linux/netfilter/ipset/ip_set_list.h", |
||||
|
||||
// From arch/arm64/include/uapi/**/*.h |
||||
|
||||
"asm/auxvec.h", |
||||
"asm/bitsperlong.h", |
||||
"asm/byteorder.h", |
||||
"asm/fcntl.h", |
||||
"asm/hwcap.h", |
||||
"asm/kvm.h", |
||||
"asm/param.h", |
||||
"asm/perf_regs.h", |
||||
"asm/posix_types.h", |
||||
"asm/ptrace.h", |
||||
"asm/setup.h", |
||||
"asm/sigcontext.h", |
||||
"asm/siginfo.h", |
||||
"asm/signal.h", |
||||
"asm/stat.h", |
||||
"asm/statfs.h", |
||||
"asm/ucontext.h", |
||||
"asm/unistd.h", |
||||
] |
||||
|
||||
genrule { |
||||
// This module generates the gen_headers_<arch>.bp file |
||||
// (i.e., a new version of this file) so that it can be |
||||
// checked later to ensure that it matches the checked- |
||||
// in version (this file). |
||||
name: "qti_generate_gen_headers_arm64", |
||||
srcs: ["arch/arm64/include/uapi/asm/Kbuild", "include/uapi/asm-generic/Kbuild.asm", "arch/arm64/include/uapi/**/*.h"], |
||||
tool_files: ["kernel_headers.py"], |
||||
cmd: "python3 $(location kernel_headers.py) " + |
||||
kernel_headers_verbose + |
||||
"--header_arch arm64 " + |
||||
"--gen_dir $(genDir) " + |
||||
"--arch_asm_kbuild $(location arch/arm64/include/uapi/asm/Kbuild) " + |
||||
"--arch_include_uapi $(locations arch/arm64/include/uapi/**/*.h) " + |
||||
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild.asm) " + |
||||
"blueprints", |
||||
out: ["gen_headers_arm64.bp"], |
||||
} |
||||
|
||||
genrule { |
||||
name: "qti_generate_kernel_headers_arm64", |
||||
tools: ["headers_install.sh"], |
||||
tool_files: [ |
||||
"kernel_headers.py", |
||||
], |
||||
srcs: [ |
||||
"arch/arm64/include/uapi/asm/Kbuild", |
||||
"include/uapi/asm-generic/Kbuild.asm", |
||||
"gen_headers_arm64.bp", |
||||
":qti_generate_gen_headers_arm64", |
||||
"Makefile", |
||||
"include/uapi/**/*.h", |
||||
"arch/arm64/include/uapi/**/*.h", |
||||
], |
||||
exclude_srcs: [ |
||||
"include/uapi/linux/a.out.h", |
||||
"include/uapi/linux/kvm_para.h", |
||||
], |
||||
cmd: "python3 $(location kernel_headers.py) " + |
||||
kernel_headers_verbose + |
||||
"--header_arch arm64 " + |
||||
"--gen_dir $(genDir) " + |
||||
"--arch_asm_kbuild $(location arch/arm64/include/uapi/asm/Kbuild) " + |
||||
"--arch_include_uapi $(locations arch/arm64/include/uapi/**/*.h) " + |
||||
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild.asm) " + |
||||
"headers " + |
||||
"--old_gen_headers_bp $(location gen_headers_arm64.bp) " + |
||||
"--new_gen_headers_bp $(location :qti_generate_gen_headers_arm64) " + |
||||
"--version_makefile $(location Makefile) " + |
||||
"--headers_install $(location headers_install.sh) " + |
||||
"--include_uapi $(locations include/uapi/**/*.h)", |
||||
out: ["linux/version.h"] + gen_headers_arm64, |
||||
} |
@ -0,0 +1,936 @@ |
||||
# Copyright 2019 Google Inc. All rights reserved. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
"""Generates gen_headers_<arch>.bp or generates/checks kernel headers.""" |
||||
|
||||
from __future__ import absolute_import |
||||
from __future__ import division |
||||
from __future__ import print_function |
||||
|
||||
import argparse |
||||
import filecmp |
||||
import os |
||||
import re |
||||
import subprocess |
||||
import sys |
||||
|
||||
|
||||
def gen_version_h(verbose, gen_dir, version_makefile): |
||||
"""Generate linux/version.h |
||||
|
||||
Scan the version_makefile for the version info, and then generate |
||||
linux/version.h in the gen_dir as done in kernel Makefile function |
||||
filechk_version.h |
||||
|
||||
Args: |
||||
verbose: Set True to print progress messages. |
||||
gen_dir: Where to place the generated files. |
||||
version_makefile: The makefile that contains version info. |
||||
Return: |
||||
If version info not found, False. Otherwise, True. |
||||
""" |
||||
|
||||
version_re = re.compile(r'VERSION\s*=\s*(\d+)') |
||||
patchlevel_re = re.compile(r'PATCHLEVEL\s*=\s*(\d+)') |
||||
sublevel_re = re.compile(r'SUBLEVEL\s*=\s*(\d+)') |
||||
|
||||
version_str = None |
||||
patchlevel_str = None |
||||
sublevel_str = None |
||||
|
||||
if verbose: |
||||
print('gen_version_h: processing [%s]' % version_makefile) |
||||
|
||||
with open(version_makefile, 'r') as f: |
||||
while not version_str or not patchlevel_str or not sublevel_str: |
||||
line = f.readline() |
||||
|
||||
if not line: |
||||
print( |
||||
'error: gen_version_h: failed to parse kernel version from %s' % |
||||
version_makefile) |
||||
return False |
||||
|
||||
line = line.rstrip() |
||||
|
||||
if verbose: |
||||
print('gen_version_h: line is %s' % line) |
||||
|
||||
if not version_str: |
||||
match = version_re.match(line) |
||||
if match: |
||||
if verbose: |
||||
print('gen_version_h: matched version [%s]' % line) |
||||
version_str = match.group(1) |
||||
continue |
||||
|
||||
if not patchlevel_str: |
||||
match = patchlevel_re.match(line) |
||||
if match: |
||||
if verbose: |
||||
print('gen_version_h: matched patchlevel [%s]' % line) |
||||
patchlevel_str = match.group(1) |
||||
continue |
||||
|
||||
if not sublevel_str: |
||||
match = sublevel_re.match(line) |
||||
if match: |
||||
if verbose: |
||||
print('gen_version_h: matched sublevel [%s]' % line) |
||||
sublevel_str = match.group(1) |
||||
continue |
||||
|
||||
version = int(version_str) |
||||
patchlevel = int(patchlevel_str) |
||||
sublevel = int(sublevel_str) |
||||
|
||||
if verbose: |
||||
print( |
||||
'gen_version_h: found kernel version %d.%d.%d' % |
||||
(version, patchlevel, sublevel)) |
||||
|
||||
version_h = os.path.join(gen_dir, 'linux', 'version.h') |
||||
|
||||
with open(version_h, 'w') as f: |
||||
# This code must match the code in Makefile in the make function |
||||
# filechk_version.h |
||||
version_code = (version << 16) + (patchlevel << 8) + sublevel |
||||
f.write('#define LINUX_VERSION_CODE %d\n' % version_code) |
||||
f.write( |
||||
'#define KERNEL_VERSION(a,b,c) ' + |
||||
'(((a) << 16) + ((b) << 8) + (c))\n') |
||||
|
||||
return True |
||||
|
||||
|
||||
def scan_arch_kbuild(verbose, arch_asm_kbuild, asm_generic_kbuild, arch_include_uapi): |
||||
"""Scan arch_asm_kbuild for generated headers. |
||||
|
||||
This function processes the Kbuild file to scan for three types of files that |
||||
need to be generated. The first type are syscall generated headers, which are |
||||
identified by adding to the generated-y make variable. The second type are |
||||
generic headers, which are arch-specific headers that simply wrap the |
||||
asm-generic counterpart, and are identified by adding to the generic-y make |
||||
variable. The third type are mandatory headers that should be present in the |
||||
/usr/include/asm folder. |
||||
|
||||
Args: |
||||
verbose: Set True to print progress messages. |
||||
arch_asm_kbuild: The Kbuild file containing lists of headers to generate. |
||||
asm_generic_kbuild: The Kbuild file containing lists of mandatory headers. |
||||
arch_include_uapi: Headers in /arch/<arch>/include/uapi directory |
||||
Return: |
||||
Two lists of discovered headers, one for generated and one for generic. |
||||
""" |
||||
|
||||
generated_y_re = re.compile(r'generated-y\s*\+=\s*(\S+)') |
||||
generic_y_re = re.compile(r'generic-y\s*\+=\s*(\S+)') |
||||
mandatory_y_re = re.compile(r'mandatory-y\s*\+=\s*(\S+)') |
||||
|
||||
# This loop parses arch_asm_kbuild for various kinds of headers to generate. |
||||
|
||||
if verbose: |
||||
print('scan_arch_kbuild: processing [%s]' % arch_asm_kbuild) |
||||
|
||||
generated_list = [] |
||||
generic_list = [] |
||||
arch_include_uapi_list = [os.path.basename(x) for x in arch_include_uapi] |
||||
mandatory_pre_list = [] |
||||
mandatory_list = [] |
||||
|
||||
|
||||
with open(arch_asm_kbuild, 'r') as f: |
||||
while True: |
||||
line = f.readline() |
||||
|
||||
if not line: |
||||
break |
||||
|
||||
line = line.rstrip() |
||||
|
||||
if verbose: |
||||
print('scan_arch_kbuild: line is %s' % line) |
||||
|
||||
match = generated_y_re.match(line) |
||||
|
||||
if match: |
||||
if verbose: |
||||
print('scan_arch_kbuild: matched [%s]' % line) |
||||
generated_list.append(match.group(1)) |
||||
continue |
||||
|
||||
match = generic_y_re.match(line) |
||||
|
||||
if match: |
||||
if verbose: |
||||
print('scan_arch_kbuild: matched [%s]' % line) |
||||
generic_list.append(match.group(1)) |
||||
continue |
||||
|
||||
# This loop parses asm_generic_kbuild for various kinds of headers to generate. |
||||
|
||||
if verbose: |
||||
print('scan_arch_kbuild: processing [%s]' % asm_generic_kbuild) |
||||
|
||||
with open(asm_generic_kbuild, 'r') as f: |
||||
while True: |
||||
line = f.readline() |
||||
|
||||
if not line: |
||||
break |
||||
|
||||
line = line.rstrip() |
||||
|
||||
if verbose: |
||||
print('scan_arch_kbuild: line is %s' % line) |
||||
|
||||
match = mandatory_y_re.match(line) |
||||
|
||||
if match: |
||||
if verbose: |
||||
print('scan_arch_kbuild: matched [%s]' % line) |
||||
mandatory_pre_list.append(match.group(1)) |
||||
continue |
||||
|
||||
# Mandatory headers need to be generated if they are not already generated. |
||||
comb_list = generic_list + generated_list + arch_include_uapi_list |
||||
mandatory_list = [x for x in mandatory_pre_list if x not in comb_list] |
||||
if verbose: |
||||
print("generic") |
||||
for x in generic_list: |
||||
print(x) |
||||
print("generated") |
||||
for x in generated_list: |
||||
print(x) |
||||
print("mandatory") |
||||
for x in mandatory_list: |
||||
print(x) |
||||
print("arch_include_uapi_list") |
||||
for x in arch_include_uapi_list: |
||||
print(x) |
||||
|
||||
return (generated_list, generic_list, mandatory_list) |
||||
|
||||
|
||||
def gen_arch_headers( |
||||
verbose, gen_dir, arch_asm_kbuild, asm_generic_kbuild, arch_syscall_tool, arch_syscall_tbl, arch_include_uapi): |
||||
"""Process arch-specific and asm-generic uapi/asm/Kbuild to generate headers. |
||||
|
||||
The function consists of a call to scan_arch_kbuild followed by three loops. |
||||
The first loop generates headers found and placed in the generated_list by |
||||
scan_arch_kbuild. The second loop generates headers found and placed in the |
||||
generic_list by the scan_arch_kbuild. The third loop generates headers found |
||||
in mandatory_list by scan_arch_kbuild. |
||||
|
||||
The function does some parsing of file names and tool invocations. If that |
||||
parsing fails for some reason (e.g., we don't know how to generate the |
||||
header) or a tool invocation fails, then this function will count that as |
||||
an error but keep processing. In the end, the function returns the number of |
||||
errors encountered. |
||||
|
||||
Args: |
||||
verbose: Set True to print progress messages. |
||||
gen_dir: Where to place the generated files. |
||||
arch_asm_kbuild: The Kbuild file containing lists of headers to generate. |
||||
asm_generic_kbuild: The Kbuild file containing lists of mandatory headers. |
||||
arch_syscall_tool: The arch script that generates syscall headers, or None. |
||||
arch_syscall_tbl: The arch script that defines syscall vectors, or None. |
||||
arch_include_uapi: Headers in arch/<arch>/include/uapi directory. |
||||
Return: |
||||
The number of parsing errors encountered. |
||||
""" |
||||
|
||||
error_count = 0 |
||||
|
||||
# First generate the lists |
||||
|
||||
(generated_list, generic_list, mandatory_list) = scan_arch_kbuild(verbose, arch_asm_kbuild, asm_generic_kbuild ,arch_include_uapi) |
||||
|
||||
# Now we're at the first loop, which is able to generate syscall headers |
||||
# found in the first loop, and placed in generated_list. It's okay for this |
||||
# list to be empty. In that case, of course, the loop does nothing. |
||||
|
||||
abi_re = re.compile(r'unistd-(\S+)\.h') |
||||
|
||||
for generated in generated_list: |
||||
gen_h = os.path.join(gen_dir, 'asm', generated) |
||||
match = abi_re.match(generated) |
||||
|
||||
if match: |
||||
abi = match.group(1) |
||||
|
||||
cmd = [ |
||||
'/bin/bash', |
||||
arch_syscall_tool, |
||||
arch_syscall_tbl, |
||||
gen_h, |
||||
abi, |
||||
'', |
||||
'__NR_SYSCALL_BASE', |
||||
] |
||||
|
||||
if verbose: |
||||
print('gen_arch_headers: cmd is %s' % cmd) |
||||
|
||||
result = subprocess.call(cmd) |
||||
|
||||
if result != 0: |
||||
print('error: gen_arch_headers: cmd %s failed %d' % (cmd, result)) |
||||
error_count += 1 |
||||
else: |
||||
print('error: gen_arch_headers: syscall header has bad filename: %s' % generated) |
||||
error_count += 1 |
||||
|
||||
# Now we're at the second loop, which generates wrappers from arch-specific |
||||
# headers listed in generic_list to the corresponding asm-generic header. |
||||
|
||||
for generic in generic_list: |
||||
wrap_h = os.path.join(gen_dir, 'asm', generic) |
||||
with open(wrap_h, 'w') as f: |
||||
f.write('#include <asm-generic/%s>\n' % generic) |
||||
|
||||
# Now we're at the third loop, which generates wrappers from asm |
||||
# headers listed in mandatory_list to the corresponding asm-generic header. |
||||
|
||||
for mandatory in mandatory_list: |
||||
wrap_h = os.path.join(gen_dir, 'asm', mandatory) |
||||
with open(wrap_h, 'w') as f: |
||||
f.write('#include <asm-generic/%s>\n' % mandatory) |
||||
return error_count |
||||
|
||||
|
||||
def run_headers_install(verbose, gen_dir, headers_install, prefix, h): |
||||
"""Process a header through the headers_install script. |
||||
|
||||
The headers_install script does some processing of a header so that it is |
||||
appropriate for inclusion in a userland program. This function invokes that |
||||
script for one header file. |
||||
|
||||
The input file is a header file found in the directory named by prefix. This |
||||
function stips the prefix from the header to generate the name of the |
||||
processed header. |
||||
|
||||
Args: |
||||
verbose: Set True to print progress messages. |
||||
gen_dir: Where to place the generated files. |
||||
headers_install: The script that munges the header. |
||||
prefix: The prefix to strip from h to generate the output filename. |
||||
h: The input header to process. |
||||
Return: |
||||
If parsing or the tool fails, False. Otherwise, True |
||||
""" |
||||
|
||||
if not h.startswith(prefix): |
||||
print('error: expected prefix [%s] on header [%s]' % (prefix, h)) |
||||
return False |
||||
|
||||
out_h = os.path.join(gen_dir, h[len(prefix):]) |
||||
(out_h_dirname, out_h_basename) = os.path.split(out_h) |
||||
h_dirname = os.path.dirname(h) |
||||
|
||||
cmd = [headers_install, out_h_dirname, h_dirname, out_h_basename] |
||||
|
||||
if verbose: |
||||
print('run_headers_install: cmd is %s' % cmd) |
||||
|
||||
result = subprocess.call(cmd) |
||||
|
||||
if result != 0: |
||||
print('error: run_headers_install: cmd %s failed %d' % (cmd, result)) |
||||
return False |
||||
|
||||
return True |
||||
|
||||
|
||||
def glob_headers(prefix, rel_glob, excludes): |
||||
"""Recursively scan the a directory for headers. |
||||
|
||||
This function recursively scans the directory identified by prefix for |
||||
headers. We don't yet have a new enough version of python3 to use the |
||||
better glob function, so right now we assume the glob is '**/*.h'. |
||||
|
||||
The function filters out any files that match the items in excludes. |
||||
|
||||
Args: |
||||
prefix: The directory to recursively scan for headers. |
||||
rel_glob: The shell-style glob that identifies the header pattern. |
||||
excludes: A list of headers to exclude from the glob. |
||||
Return: |
||||
A list of headers discovered with excludes excluded. |
||||
""" |
||||
|
||||
# If we had python 3.5+, we could use the fancy new glob.glob. |
||||
# full_glob = os.path.join(prefix, rel_glob) |
||||
# full_srcs = glob.glob(full_glob, recursive=True) |
||||
|
||||
full_dirs = [prefix] |
||||
full_srcs = [] |
||||
|
||||
while full_dirs: |
||||
full_dir = full_dirs.pop(0) |
||||
items = sorted(os.listdir(full_dir)) |
||||
|
||||
for item in items: |
||||
full_item = os.path.join(full_dir, item) |
||||
|
||||
if os.path.isdir(full_item): |
||||
full_dirs.append(full_item) |
||||
continue |
||||
|
||||
if full_item in excludes: |
||||
continue |
||||
|
||||
if full_item.endswith('.h'): |
||||
full_srcs.append(full_item) |
||||
|
||||
return full_srcs |
||||
|
||||
|
||||
def find_out(verbose, module_dir, prefix, rel_glob, excludes, outs): |
||||
"""Build a list of outputs for the genrule that creates kernel headers. |
||||
|
||||
This function scans for headers in the source tree and produces a list of |
||||
output (generated) headers. |
||||
|
||||
Args: |
||||
verbose: Set True to print progress messages. |
||||
module_dir: The root directory of the kernel source. |
||||
prefix: The prefix with in the kernel source tree to search for headers. |
||||
rel_glob: The pattern to use when matching headers under prefix. |
||||
excludes: A list of files to exclude from the glob. |
||||
outs: The list to populdate with the headers that will be generated. |
||||
Return: |
||||
The number of errors encountered. |
||||
""" |
||||
|
||||
# Turn prefix, which is relative to the soong module, to a full prefix that |
||||
# is relative to the Android source tree. |
||||
|
||||
full_prefix = os.path.join(module_dir, prefix) |
||||
|
||||
# Convert the list of excludes, which are relative to the soong module, to a |
||||
# set of excludes (for easy hashing), relative to the Android source tree. |
||||
|
||||
full_excludes = set() |
||||
|
||||
if excludes: |
||||
for exclude in excludes: |
||||
full_exclude = os.path.join(full_prefix, exclude) |
||||
full_excludes.add(full_exclude) |
||||
|
||||
# Glob those headers. |
||||
|
||||
full_srcs = glob_headers(full_prefix, rel_glob, full_excludes) |
||||
|
||||
# Now convert the file names, which are relative to the Android source tree, |
||||
# to be relative to the gen dir. This means stripping off the module prefix |
||||
# and the directory within this module. |
||||
|
||||
module_dir_sep = module_dir + os.sep |
||||
prefix_sep = prefix + os.sep |
||||
|
||||
if verbose: |
||||
print('find_out: module_dir_sep [%s]' % module_dir_sep) |
||||
print('find_out: prefix_sep [%s]' % prefix_sep) |
||||
|
||||
error_count = 0 |
||||
|
||||
for full_src in full_srcs: |
||||
if verbose: |
||||
print('find_out: full_src [%s]' % full_src) |
||||
|
||||
if not full_src.startswith(module_dir_sep): |
||||
print('error: expected %s to start with %s' % (full_src, module_dir_sep)) |
||||
error_count += 1 |
||||
continue |
||||
|
||||
local_src = full_src[len(module_dir_sep):] |
||||
|
||||
if verbose: |
||||
print('find_out: local_src [%s]' % local_src) |
||||
|
||||
if not local_src.startswith(prefix_sep): |
||||
print('error: expected %s to start with %s' % (local_src, prefix_sep)) |
||||
error_count += 1 |
||||
continue |
||||
|
||||
# After stripping the module directory and the prefix, we're left with the |
||||
# name of a header that we'll generate, relative to the base of of a the |
||||
# the include path. |
||||
|
||||
local_out = local_src[len(prefix_sep):] |
||||
|
||||
if verbose: |
||||
print('find_out: local_out [%s]' % local_out) |
||||
|
||||
outs.append(local_out) |
||||
|
||||
return error_count |
||||
|
||||
|
||||
def gen_blueprints( |
||||
verbose, header_arch, gen_dir, arch_asm_kbuild, asm_generic_kbuild, module_dir, |
||||
rel_arch_asm_kbuild, rel_asm_generic_kbuild, arch_include_uapi, techpack_include_uapi): |
||||
"""Generate a blueprints file containing modules that invoke this script. |
||||
|
||||
This function generates a blueprints file that contains modules that |
||||
invoke this script to generate kernel headers. We generate the blueprints |
||||
file as needed, but we don't actually use the generated file. The blueprints |
||||
file that we generate ends up in the out directory, and we can use it to |
||||
detect if the checked-in version of the file (in the source directory) is out |
||||
of date. This pattern occurs in the Android source tree in several places. |
||||
|
||||
Args: |
||||
verbose: Set True to print progress messages. |
||||
header_arch: The arch for which to generate headers. |
||||
gen_dir: Where to place the generated files. |
||||
arch_asm_kbuild: The Kbuild file containing lists of headers to generate. |
||||
asm_generic_kbuild: The Kbuild file containing lists of mandatory headers. |
||||
module_dir: The root directory of the kernel source. |
||||
rel_arch_asm_kbuild: arch_asm_kbuild relative to module_dir. |
||||
Return: |
||||
The number of errors encountered. |
||||
""" |
||||
error_count = 0 |
||||
|
||||
# The old and new blueprints files. We generate the new one, but we need to |
||||
# refer to the old one in the modules that we generate. |
||||
old_gen_headers_bp = 'gen_headers_%s.bp' % header_arch |
||||
new_gen_headers_bp = os.path.join(gen_dir, old_gen_headers_bp) |
||||
|
||||
# Tools and tool files. |
||||
headers_install_sh = 'headers_install.sh' |
||||
kernel_headers_py = 'kernel_headers.py' |
||||
arm_syscall_tool = 'arch/arm/tools/syscallhdr.sh' |
||||
|
||||
# Sources |
||||
makefile = 'Makefile' |
||||
arm_syscall_tbl = 'arch/arm/tools/syscall.tbl' |
||||
rel_glob = '**/*.h' |
||||
generic_prefix = 'include/uapi' |
||||
arch_prefix = os.path.join('arch', header_arch, generic_prefix) |
||||
generic_src = os.path.join(generic_prefix, rel_glob) |
||||
arch_src = os.path.join(arch_prefix, rel_glob) |
||||
techpack_src = 'techpack/*' |
||||
|
||||
# Excluded sources, architecture specific. |
||||
exclude_srcs = [] |
||||
|
||||
if header_arch == "arm": |
||||
exclude_srcs = ['linux/a.out.h'] |
||||
|
||||
if header_arch == "arm64": |
||||
exclude_srcs = ['linux/a.out.h', 'linux/kvm_para.h'] |
||||
|
||||
# Scan the arch_asm_kbuild file for files that need to be generated and those |
||||
# that are generic (i.e., need to be wrapped). |
||||
|
||||
(generated_list, generic_list, mandatory_list) = scan_arch_kbuild(verbose, |
||||
arch_asm_kbuild, asm_generic_kbuild, arch_include_uapi) |
||||
|
||||
generic_out = [] |
||||
error_count += find_out( |
||||
verbose, module_dir, generic_prefix, rel_glob, exclude_srcs, generic_out) |
||||
|
||||
arch_out = [] |
||||
error_count += find_out( |
||||
verbose, module_dir, arch_prefix, rel_glob, None, arch_out) |
||||
|
||||
techpack_out = [x.split('include/uapi/')[1] for x in techpack_include_uapi] |
||||
|
||||
if error_count != 0: |
||||
return error_count |
||||
|
||||
# Generate the blueprints file. |
||||
|
||||
if verbose: |
||||
print('gen_blueprints: generating %s' % new_gen_headers_bp) |
||||
|
||||
with open(new_gen_headers_bp, 'w') as f: |
||||
f.write('// ***** DO NOT EDIT *****\n') |
||||
f.write('// This file is generated by %s\n' % kernel_headers_py) |
||||
f.write('\n') |
||||
f.write('gen_headers_%s = [\n' % header_arch) |
||||
|
||||
if generated_list: |
||||
f.write('\n') |
||||
f.write(' // Matching generated-y:\n') |
||||
f.write('\n') |
||||
for h in generated_list: |
||||
f.write(' "asm/%s",\n' % h) |
||||
|
||||
if generic_list: |
||||
f.write('\n') |
||||
f.write(' // Matching generic-y:\n') |
||||
f.write('\n') |
||||
for h in generic_list: |
||||
f.write(' "asm/%s",\n' % h) |
||||
|
||||
if mandatory_list: |
||||
f.write('\n') |
||||
f.write(' // Matching mandatory-y:\n') |
||||
f.write('\n') |
||||
for h in mandatory_list: |
||||
f.write(' "asm/%s",\n' % h) |
||||
|
||||
if generic_out: |
||||
f.write('\n') |
||||
f.write(' // From %s\n' % generic_src) |
||||
f.write('\n') |
||||
for h in generic_out: |
||||
f.write(' "%s",\n' % h) |
||||
|
||||
if arch_out: |
||||
f.write('\n') |
||||
f.write(' // From %s\n' % arch_src) |
||||
f.write('\n') |
||||
for h in arch_out: |
||||
f.write(' "%s",\n' % h) |
||||
|
||||
if techpack_out: |
||||
f.write('\n') |
||||
f.write(' // From %s\n' % techpack_src) |
||||
f.write('\n') |
||||
for h in techpack_out: |
||||
f.write(' "%s",\n' % h) |
||||
|
||||
f.write(']\n') |
||||
f.write('\n') |
||||
|
||||
gen_blueprints_module_name = 'qti_generate_gen_headers_%s' % header_arch |
||||
|
||||
f.write('genrule {\n') |
||||
f.write(' // This module generates the gen_headers_<arch>.bp file\n') |
||||
f.write(' // (i.e., a new version of this file) so that it can be\n') |
||||
f.write(' // checked later to ensure that it matches the checked-\n') |
||||
f.write(' // in version (this file).\n') |
||||
f.write(' name: "%s",\n' % gen_blueprints_module_name) |
||||
f.write(' srcs: ["%s", "%s", "%s"],\n' % (rel_arch_asm_kbuild, rel_asm_generic_kbuild, arch_src)) |
||||
f.write(' tool_files: ["kernel_headers.py"],\n') |
||||
f.write(' cmd: "python3 $(location kernel_headers.py) " +\n') |
||||
f.write(' kernel_headers_verbose +\n') |
||||
f.write(' "--header_arch %s " +\n' % header_arch) |
||||
f.write(' "--gen_dir $(genDir) " +\n') |
||||
f.write(' "--arch_asm_kbuild $(location %s) " +\n' % rel_arch_asm_kbuild) |
||||
f.write(' "--arch_include_uapi $(locations %s) " +\n' % arch_src) |
||||
f.write(' "--asm_generic_kbuild $(location %s) " +\n' % rel_asm_generic_kbuild) |
||||
f.write(' "blueprints",\n') |
||||
f.write(' out: ["gen_headers_%s.bp"],\n' % header_arch) |
||||
f.write('}\n') |
||||
f.write('\n') |
||||
|
||||
f.write('genrule {\n') |
||||
f.write(' name: "qti_generate_kernel_headers_%s",\n' % header_arch) |
||||
f.write(' tools: ["%s"],\n' % headers_install_sh) |
||||
f.write(' tool_files: [\n') |
||||
f.write(' "%s",\n' % kernel_headers_py) |
||||
|
||||
if header_arch == "arm": |
||||
f.write(' "%s",\n' % arm_syscall_tool) |
||||
|
||||
f.write(' ],\n') |
||||
f.write(' srcs: [\n') |
||||
f.write(' "%s",\n' % rel_arch_asm_kbuild) |
||||
f.write(' "%s",\n' % rel_asm_generic_kbuild) |
||||
f.write(' "%s",\n' % old_gen_headers_bp) |
||||
f.write(' ":%s",\n' % gen_blueprints_module_name) |
||||
f.write(' "%s",\n' % makefile) |
||||
|
||||
if header_arch == "arm": |
||||
f.write(' "%s",\n' % arm_syscall_tbl) |
||||
|
||||
f.write(' "%s",\n' % generic_src) |
||||
f.write(' "%s",\n' % arch_src) |
||||
f.write(' ],\n') |
||||
|
||||
if exclude_srcs: |
||||
f.write(' exclude_srcs: [\n') |
||||
for h in exclude_srcs: |
||||
f.write(' "%s",\n' % os.path.join(generic_prefix, h)) |
||||
f.write(' ],\n') |
||||
|
||||
f.write(' cmd: "python3 $(location %s) " +\n' % kernel_headers_py) |
||||
f.write(' kernel_headers_verbose +\n') |
||||
f.write(' "--header_arch %s " +\n' % header_arch) |
||||
f.write(' "--gen_dir $(genDir) " +\n') |
||||
f.write(' "--arch_asm_kbuild $(location %s) " +\n' % rel_arch_asm_kbuild) |
||||
f.write(' "--arch_include_uapi $(locations %s) " +\n' % arch_src) |
||||
f.write(' "--asm_generic_kbuild $(location %s) " +\n' % rel_asm_generic_kbuild) |
||||
f.write(' "headers " +\n') |
||||
f.write(' "--old_gen_headers_bp $(location %s) " +\n' % old_gen_headers_bp) |
||||
f.write(' "--new_gen_headers_bp $(location :%s) " +\n' % gen_blueprints_module_name) |
||||
f.write(' "--version_makefile $(location %s) " +\n' % makefile) |
||||
|
||||
if header_arch == "arm": |
||||
f.write(' "--arch_syscall_tool $(location %s) " +\n' % arm_syscall_tool) |
||||
f.write(' "--arch_syscall_tbl $(location %s) " +\n' % arm_syscall_tbl) |
||||
|
||||
f.write(' "--headers_install $(location %s) " +\n' % headers_install_sh) |
||||
f.write(' "--include_uapi $(locations %s)",\n' % generic_src) |
||||
f.write(' out: ["linux/version.h"] + gen_headers_%s,\n' % header_arch) |
||||
f.write('}\n') |
||||
|
||||
return 0 |
||||
|
||||
|
||||
def gen_headers( |
||||
verbose, header_arch, gen_dir, arch_asm_kbuild, asm_generic_kbuild, module_dir, |
||||
old_gen_headers_bp, new_gen_headers_bp, version_makefile, |
||||
arch_syscall_tool, arch_syscall_tbl, headers_install, include_uapi, |
||||
arch_include_uapi, techpack_include_uapi): |
||||
"""Generate the kernel headers. |
||||
|
||||
This script generates the version.h file, the arch-specific headers including |
||||
syscall-related generated files and wrappers around generic files, and uses |
||||
the headers_install tool to process other generic uapi and arch-specific uapi |
||||
files. |
||||
|
||||
Args: |
||||
verbose: Set True to print progress messages. |
||||
header_arch: The arch for which to generate headers. |
||||
gen_dir: Where to place the generated files. |
||||
arch_asm_kbuild: The Kbuild file containing lists of headers to generate. |
||||
asm_generic_kbuild: The Kbuild file containing mandatory headers. |
||||
module_dir: The root directory of the kernel source. |
||||
old_gen_headers_bp: The old gen_headers_<arch>.bp file to check. |
||||
new_gen_headers_bp: The new gen_headers_<arch>.bp file to check. |
||||
version_makefile: The kernel Makefile that contains version info. |
||||
arch_syscall_tool: The arch script that generates syscall headers. |
||||
arch_syscall_tbl: The arch script that defines syscall vectors. |
||||
headers_install: The headers_install tool to process input headers. |
||||
include_uapi: The list of include/uapi header files. |
||||
arch_include_uapi: The list of arch/<arch>/include/uapi header files. |
||||
Return: |
||||
The number of errors encountered. |
||||
""" |
||||
|
||||
if not filecmp.cmp(old_gen_headers_bp, new_gen_headers_bp): |
||||
print('error: gen_headers blueprints file is out of date, suggested fix:') |
||||
print('cp %s %s' % (new_gen_headers_bp, old_gen_headers_bp)) |
||||
print('then re-run the build') |
||||
return 1 |
||||
|
||||
error_count = 0 |
||||
|
||||
if not gen_version_h(verbose, gen_dir, version_makefile): |
||||
error_count += 1 |
||||
|
||||
error_count += gen_arch_headers( |
||||
verbose, gen_dir, arch_asm_kbuild, asm_generic_kbuild, arch_syscall_tool, arch_syscall_tbl ,arch_include_uapi) |
||||
|
||||
uapi_include_prefix = os.path.join(module_dir, 'include', 'uapi') + os.sep |
||||
|
||||
arch_uapi_include_prefix = os.path.join( |
||||
module_dir, 'arch', header_arch, 'include', 'uapi') + os.sep |
||||
|
||||
for h in include_uapi: |
||||
if not run_headers_install( |
||||
verbose, gen_dir, headers_install, |
||||
uapi_include_prefix, h): |
||||
error_count += 1 |
||||
|
||||
for h in arch_include_uapi: |
||||
if not run_headers_install( |
||||
verbose, gen_dir, headers_install, |
||||
arch_uapi_include_prefix, h): |
||||
error_count += 1 |
||||
|
||||
for h in techpack_include_uapi: |
||||
techpack_uapi_include_prefix = os.path.join(h.split('/include/uapi')[0], 'include', 'uapi') + os.sep |
||||
if not run_headers_install( |
||||
verbose, gen_dir, headers_install, |
||||
techpack_uapi_include_prefix, h): |
||||
error_count += 1 |
||||
|
||||
return error_count |
||||
|
||||
def extract_techpack_uapi_headers(verbose, module_dir): |
||||
|
||||
"""EXtract list of uapi headers from techpack/* directories. We need to export |
||||
these headers to userspace. |
||||
|
||||
Args: |
||||
verbose: Verbose option is provided to script |
||||
module_dir: Base directory |
||||
Returs: |
||||
List of uapi headers |
||||
""" |
||||
|
||||
techpack_subdir = [] |
||||
techpack_dir = os.path.join(module_dir,'techpack') |
||||
techpack_uapi = [] |
||||
techpack_uapi_sub = [] |
||||
|
||||
#get list of techpack directories under techpack/ |
||||
if os.path.isdir(techpack_dir): |
||||
items = sorted(os.listdir(techpack_dir)) |
||||
for x in items: |
||||
p = os.path.join(techpack_dir, x) |
||||
if os.path.isdir(p): |
||||
techpack_subdir.append(p) |
||||
|
||||
#Print list of subdirs obtained |
||||
if (verbose): |
||||
for x in techpack_subdir: |
||||
print(x) |
||||
|
||||
#For every subdirectory get list of .h files under include/uapi and append to techpack_uapi list |
||||
for x in techpack_subdir: |
||||
techpack_uapi_path = os.path.join(x, 'include/uapi') |
||||
if (os.path.isdir(techpack_uapi_path)): |
||||
techpack_uapi_sub = [] |
||||
find_out(verbose, x, 'include/uapi', '**/*.h', None, techpack_uapi_sub) |
||||
tmp = [os.path.join(techpack_uapi_path, y) for y in techpack_uapi_sub] |
||||
techpack_uapi = techpack_uapi + tmp |
||||
|
||||
if (verbose): |
||||
for x in techpack_uapi: |
||||
print(x) |
||||
|
||||
return techpack_uapi |
||||
|
||||
def main(): |
||||
"""Parse command line arguments and perform top level control.""" |
||||
|
||||
parser = argparse.ArgumentParser( |
||||
description=__doc__, |
||||
formatter_class=argparse.RawDescriptionHelpFormatter) |
||||
|
||||
# Arguments that apply to every invocation of this script. |
||||
|
||||
parser.add_argument( |
||||
'--verbose', |
||||
action='store_true', |
||||
help='Print output that describes the workings of this script.') |
||||
parser.add_argument( |
||||
'--header_arch', |
||||
required=True, |
||||
help='The arch for which to generate headers.') |
||||
parser.add_argument( |
||||
'--gen_dir', |
||||
required=True, |
||||
help='Where to place the generated files.') |
||||
parser.add_argument( |
||||
'--arch_asm_kbuild', |
||||
required=True, |
||||
help='The Kbuild file containing lists of headers to generate.') |
||||
parser.add_argument( |
||||
'--asm_generic_kbuild', |
||||
required=True, |
||||
help='The Kbuild file containing lists of mandatory headers.') |
||||
parser.add_argument( |
||||
'--arch_include_uapi', |
||||
required=True, |
||||
nargs='*', |
||||
help='The list of arch/<arch>/include/uapi header files.') |
||||
|
||||
# The modes. |
||||
|
||||
subparsers = parser.add_subparsers( |
||||
dest='mode', |
||||
help='Select mode') |
||||
parser_blueprints = subparsers.add_parser( |
||||
'blueprints', |
||||
help='Generate the gen_headers_<arch>.bp file.') |
||||
parser_headers = subparsers.add_parser( |
||||
'headers', |
||||
help='Check blueprints, then generate kernel headers.') |
||||
|
||||
# Arguments that apply to headers mode. |
||||
|
||||
parser_headers.add_argument( |
||||
'--old_gen_headers_bp', |
||||
required=True, |
||||
help='The old gen_headers_<arch>.bp file to check.') |
||||
parser_headers.add_argument( |
||||
'--new_gen_headers_bp', |
||||
required=True, |
||||
help='The new gen_headers_<arch>.bp file to check.') |
||||
parser_headers.add_argument( |
||||
'--version_makefile', |
||||
required=True, |
||||
help='The kernel Makefile that contains version info.') |
||||
parser_headers.add_argument( |
||||
'--arch_syscall_tool', |
||||
help='The arch script that generates syscall headers, if applicable.') |
||||
parser_headers.add_argument( |
||||
'--arch_syscall_tbl', |
||||
help='The arch script that defines syscall vectors, if applicable.') |
||||
parser_headers.add_argument( |
||||
'--headers_install', |
||||
required=True, |
||||
help='The headers_install tool to process input headers.') |
||||
parser_headers.add_argument( |
||||
'--include_uapi', |
||||
required=True, |
||||
nargs='*', |
||||
help='The list of include/uapi header files.') |
||||
|
||||
args = parser.parse_args() |
||||
|
||||
if args.verbose: |
||||
print('mode [%s]' % args.mode) |
||||
print('header_arch [%s]' % args.header_arch) |
||||
print('gen_dir [%s]' % args.gen_dir) |
||||
print('arch_asm_kbuild [%s]' % args.arch_asm_kbuild) |
||||
print('asm_generic_kbuild [%s]' % args.asm_generic_kbuild) |
||||
|
||||
# Extract the module_dir from args.arch_asm_kbuild and rel_arch_asm_kbuild. |
||||
|
||||
rel_arch_asm_kbuild = os.path.join( |
||||
'arch', args.header_arch, 'include/uapi/asm/Kbuild') |
||||
|
||||
suffix = os.sep + rel_arch_asm_kbuild |
||||
|
||||
if not args.arch_asm_kbuild.endswith(suffix): |
||||
print('error: expected %s to end with %s' % (args.arch_asm_kbuild, suffix)) |
||||
return 1 |
||||
|
||||
module_dir = args.arch_asm_kbuild[:-len(suffix)] |
||||
|
||||
rel_asm_generic_kbuild = os.path.join('include/uapi/asm-generic', os.path.basename(args.asm_generic_kbuild)) |
||||
|
||||
|
||||
if args.verbose: |
||||
print('module_dir [%s]' % module_dir) |
||||
|
||||
# Get list of techpack uapi headers to be exported from techpack/* directories. |
||||
techpack_uapi = extract_techpack_uapi_headers(args.verbose, module_dir) |
||||
|
||||
if args.mode == 'blueprints': |
||||
return gen_blueprints( |
||||
args.verbose, args.header_arch, args.gen_dir, args.arch_asm_kbuild, |
||||
args.asm_generic_kbuild, module_dir, rel_arch_asm_kbuild, rel_asm_generic_kbuild, args.arch_include_uapi, techpack_uapi) |
||||
|
||||
if args.mode == 'headers': |
||||
if args.verbose: |
||||
print('old_gen_headers_bp [%s]' % args.old_gen_headers_bp) |
||||
print('new_gen_headers_bp [%s]' % args.new_gen_headers_bp) |
||||
print('version_makefile [%s]' % args.version_makefile) |
||||
print('arch_syscall_tool [%s]' % args.arch_syscall_tool) |
||||
print('arch_syscall_tbl [%s]' % args.arch_syscall_tbl) |
||||
print('headers_install [%s]' % args.headers_install) |
||||
|
||||
return gen_headers( |
||||
args.verbose, args.header_arch, args.gen_dir, args.arch_asm_kbuild, |
||||
args.asm_generic_kbuild, module_dir, args.old_gen_headers_bp, args.new_gen_headers_bp, |
||||
args.version_makefile, args.arch_syscall_tool, args.arch_syscall_tbl, |
||||
args.headers_install, args.include_uapi, args.arch_include_uapi, techpack_uapi) |
||||
|
||||
print('error: unknown mode: %s' % args.mode) |
||||
return 1 |
||||
|
||||
|
||||
if __name__ == '__main__': |
||||
sys.exit(main()) |
Loading…
Reference in new issue