Thursday, August 3, 2017

backports driver



##################################################################################
git clone /openwrt/src/linux-3.14 ./mac80211-kernel
   (_LINUX_SRC <- CONFIG_EXTERNAL_KERNEL_TREE
  <- openwrt/configs/board_xxx.config
  <- CONFIG_EXTERNAL_KERNEL_TREE="$(TOPDIR)/src/linux-4.14")
cd ./mac80211-kernel
git remote add src git://codeaurora.org/quic/qsdk/kvalo/ath.git
git fetch src
cd ./mac80211-kernel
git checkout c86046a
git clone git://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git ./mac80211-source
cp files/copy-list.ath ./mac80211-source
git checkout e3c56e4
./gentree.py --verbose --clean --copy-list ./copy-list.ath ../mac80211-kernel ./backports-out

cd ./backports-out

make -C "./backports-out" CROSS_COMPILE="arm-openwrt-linux-uclibcgnueabi-" ARCH="arm" EXTRA_CFLAGS="-I./backports-out/include" KLIB_BUILD="./linux-3.14.43" MODPROBE=true KLIB=/lib/modules/3.14.43 KERNEL_SUBLEVEL=14 KBUILD_LDFLAGS_MODULE_PREREQ= olddefconfig

make   -C "./backports-out" CROSS_COMPILE="arm-openwrt-linux-uclibcgnueabi-" ARCH="arm" EXTRA_CFLAGS="-I./backports-out/include" KLIB_BUILD="./linux-3.14.43" MODPROBE=true KLIB=/lib/modules/3.14.43 KERNEL_SUBLEVEL=14 KBUILD_LDFLAGS_MODULE_PREREQ= modules


##################################################################################
#
# Generate own backports package
#
##################################################################################

1.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git

2.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

3.
./gentree.py --verbose --clean --copy-list copy-list <kernel tree> <output directory>
./gentree.py --verbose --clean --copy-list copy-list /home/peter/works/src/dfs_on_mesh/mac80211-next ./output/

* against ubuntu kernel source
/usr/src/linux-headers-4.18.4-041804-generic

4.
output$ make defconfig-ath10k

5.
make

6.
sudo make install

Tips:
usage: gentree.py [-h] [--copy-list <listfile>] [--git-revision <revision>]
                  [--clean] [--integrate] [--refresh] [--base-name <name>]
                  [--gitdebug] [--verbose]
                  [--extra-driver <source dir> <copy-list>] [--kup]
                  [--kup-test] [--test-cocci <sp_file>]
                  [--profile-cocci <sp_file>]
                  <kernel tree> <output directory>

##################################################################################
===================================================================
** spatch error ?
- most likely because of python script support issue.
- install python-dev before building coccinelle
- sudo apt install python python-dev (python2.7 python2.7-dev)

** install spatch from ubuntu repo
sudo apt install coccinelle

** install spatch from source
git clone https://github.com/coccinelle/coccinelle.git

** You must first install a recent version of OCaml (at least 3.12.1)
$ sudo apt install ocaml
$ ocaml
     OCaml version 4.02.3

** install the following packages
 - pkg-config (optional, but strongly recommended)
 - ocaml-native-compilers (or alternatively ocaml)
 - ocaml-findlib
 - menhir and libmenhir-ocaml-dev (optional, bundled)
 - libpcre-ocaml-dev (optional, bundled)
 - texlive-fonts-extra (for the documentation)

** ??
To build you will need: ocaml ncurses-devel

** try to use the package manager of your distribution to install the build dependencies.
sudo apt-get build-dep coccinelle

** include python supports
need to set some environment variables so that the python libraries are found.
(I expect installing python sets its library location automatically)

** build commands
./autogen
 ./configure
 make
 make install

** trouble shooting
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
trying to overwrite '/usr/share/doc/texlive-doc/latex/mweights/README', which is also in package texlive-latex-extra-doc 2015.20160320-1

sudo dpkg -P texlive-latex-extra-doc
sudo apt-get install -f

Error: Unbound module Pcre
 $ sudo apt install libpcre-ocaml-dev




Error: Unbound module Parmap
 $ sudo apt install libparmap-ocaml-dev

*** upgrade coccinelle from rc24 to 1.0.0

tools/coccinelle/Makefile

PKG_NAME:=coccinelle
PKG_VERSION:=1.0.0

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/coccinelle/coccinelle/archive/
===================================================================

* backport make command line (details of #5) *

backports-20170804-3.14.77-3dc0225$ make defconfig-ath10k
Generating local configuration database from kernel ... done.
cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer   -c -o conf.o conf.c
cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer   -c -o zconf.tab.o zconf.tab.c
cc   conf.o zconf.tab.o   -o conf
#
# configuration written to .config

backports/Makefile
Kconfig.kernel: $(STAMP_KERNEL_CONFIG) .local-symbols
@printf "Generating local configuration database from kernel ..."

. /openwrt/include/shell.sh; var2file "V_mac80211_config" /openwrt/build_dir/target-arm_cortex-a7_uClibc-1.0.14_eabi/linux-xxxx/backports-20170804-3.14.77-3dc0225/.config

qca/feeds/wlan-open/mac80211/Makefile:
define Build/Compile $(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config $(MAKE) $(MAKE_OPTS) olddefconfig $(call Build/Compile/kmod) endef

define mac80211_config
$(call ConfigVars,m)$(call ConfigVars,y)
endef
$(eval $(call shexport,mac80211_config))

qsdk\rules.mk
define shvar
V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
endef

define shexport
export $(call shvar,$(1))=$$(call $(1))
endef

(cd /qsdk/tmp/dl/mac80211-kernel; git remote add src /ath; git fetch src)

make -C "backports-20170803-3.14.77-3dc0225"
 CROSS_COMPILE="arm-openwrt-linux-uclibcgnueabi-"
 ARCH="arm"
 EXTRA_CFLAGS="-I/backports-20170803-3.14.77-3dc0225/include"
 KLIB_BUILD="/linux/linux-3.14.77"
 MODPROBE=true
 KLIB=/lib/modules/3.14.77
 KERNEL_SUBLEVEL=14
 KBUILD_LDFLAGS_MODULE_PREREQ= olddefconfig

feeds/wlan-open/Makefile
define Build/Prepare
rm -rf $(PKG_BUILD_DIR)
mkdir -p $(PKG_BUILD_DIR)
$(PKG_UNPACK)
$(Build/Patch)
$(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
rm -rf \
$(PKG_BUILD_DIR)/include/linux/ssb \
$(PKG_BUILD_DIR)/include/linux/bcma \
$(PKG_BUILD_DIR)/include/net/bluetooth

rm -f \
$(PKG_BUILD_DIR)/include/linux/cordic.h \
$(PKG_BUILD_DIR)/include/linux/crc8.h \
$(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \
$(PKG_BUILD_DIR)/include/linux/wl12xx.h \
$(PKG_BUILD_DIR)/include/linux/spi/libertas_spi.h \
$(PKG_BUILD_DIR)/include/net/ieee80211.h

echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version
$(CP) ./files/regdb.txt $(PKG_BUILD_DIR)/net/wireless/db.txt
endef


openwrt/include/package.mk

define Build/DefaultTargets
  $(if $(QUILT),$(Build/Quilt))
  $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
  $(call Build/Autoclean)

  download:
$(foreach hook,$(Hooks/Download),
$(call $(hook))$(sep)
)

  $(STAMP_PREPARED) : export PATH=$$(TARGET_PATH_PKG)
  $(STAMP_PREPARED):
@-rm -rf $(PKG_BUILD_DIR)
@mkdir -p $(PKG_BUILD_DIR)
$(foreach hook,$(Hooks/Prepare/Pre),$(call $(hook))$(sep))
$(Build/Prepare)
$(foreach hook,$(Hooks/Prepare/Post),$(call $(hook))$(sep))
touch $$@

openwrt/include/package-default.mk
Build/Patch:=$(Build/Patch/Default)

openwrt/include/package-default.mk
define Build/Patch/Default
$(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR),)
$(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
endef

scripts/patch-kernel.sh: 
for i in ${patchdir}/${patchpattern} ; do
   echo "Applying ${i} using ${type}: "

-----------------------------------------------
git clone /openwrt/src/linux-3.14 ./mac80211-kernel
   (_LINUX_SRC <- CONFIG_EXTERNAL_KERNEL_TREE
  <- openwrt/configs/board_xxx.config
  <- CONFIG_EXTERNAL_KERNEL_TREE="$(TOPDIR)/src/linux-4.14")
cd ./mac80211-kernel
git remote add src git://codeaurora.org/quic/qsdk/kvalo/ath.git
git fetch src
cd ./mac80211-kernel
git checkout c86046a
git clone git://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git ./mac80211-source
cp files/copy-list.ath ./mac80211-source
git checkout e3c56e4
./gentree.py --verbose --clean --copy-list ./copy-list.ath ../mac80211-kernel ./backports-out

cd ./backports-out

make -C "./backports-out" CROSS_COMPILE="arm-openwrt-linux-uclibcgnueabi-" ARCH="arm" EXTRA_CFLAGS="-I./backports-out/include" KLIB_BUILD="./linux-3.14.43" MODPROBE=true KLIB=/lib/modules/3.14.43 KERNEL_SUBLEVEL=14 KBUILD_LDFLAGS_MODULE_PREREQ= olddefconfig

make   -C "./backports-out" CROSS_COMPILE="arm-openwrt-linux-uclibcgnueabi-" ARCH="arm" EXTRA_CFLAGS="-I./backports-out/include" KLIB_BUILD="./linux-3.14.43" MODPROBE=true KLIB=/lib/modules/3.14.43 KERNEL_SUBLEVEL=14 KBUILD_LDFLAGS_MODULE_PREREQ= modules

*****
backports/net/mac80211/Kconfig
config MAC80211
tristate "Generic IEEE 802.11 Networking Stack (mac80211)"
depends on m
depends on CFG80211
depends on CRYPTO
depends on CRYPTO_ARC4
depends on CRYPTO_AES
select BPAUTO_CRYPTO_CCM
depends on CRYPTO_GCM
depends on CRYPTO_CMAC
depends on CRC32

linux-3.14.43/.config
#
# Hash modes
#
# CONFIG_CRYPTO_CMAC is not set

--------------

Applying patches from patches to ./openwrt/tmp/dl/backports-20170821-3.14.43-3dc0225 ...
Failed to process SmPL patch 0001-group-attr/0001-group_attr_class.cocci with 1
Makefile:236: recipe for target './openwrt/dl/backports-20170821-3.14.43-3dc0225.tar.bz2' failed
make[2]: *** [./openwrt/dl/backports-20170821-3.14.43-3dc0225.tar.bz2] Error 2
make[2]: Leaving directory './openwrt/qca/feeds/wlan-open/mac80211'
package/Makefile:191: recipe for target 'package/feeds/wlan_open/mac80211/compile' failed
make[1]: *** [package/feeds/wlan_open/mac80211/compile] Error 2
make[1]: Leaving directory './openwrt'
./openwrt/include/toplevel.mk:184: recipe for target 'package/feeds/wlan_open/mac80211/compile' failed
make: *** [package/feeds/wlan_open/mac80211/compile] Error 2

----------

Applying SmPL patch 0001-group-attr/0003-class_groups.cocci
['/home/peter/works/src/backports/backports/devel/pycocci', '-v', '/home/peter/works/src/backports/backports/patches/0001-group-attr/0003-class_groups.cocci', '/home/peter/works/src/backports/backports/output']

peter@peter-dfs:~/works/src/backports/backports$ ./devel/pycocci -j 4 -v ./patches/0027-genl-const/genl-const.cocci ./output/
jobs arg: threds: 4
jobs from list:
[]
ret_q:
<multiprocessing.queues.Queue object at 0x7fc5ad2f93d0>
spatch --sp-file ./patches/0027-genl-const/genl-const.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir ./output/ -max 4 -index 0
spatch --sp-file ./patches/0027-genl-const/genl-const.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir ./output/ -max 4 -index 1
spatch --sp-file ./patches/0027-genl-const/genl-const.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir ./output/ -max 4 -index 2
spatch --sp-file ./patches/0027-genl-const/genl-const.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir ./output/ -max 4 -index 3
num:
0
ret:
255
fn:
/tmp/62hOrV/.tmp_spatch_worker.0
Failed to apply changes from genl-const.cocci
Specific log output from change that failed using genl-const.cocci
init_defs_builtins: /usr/local/lib/coccinelle/standard.h
plus: parse error:
  File "./patches/0027-genl-const/genl-const.cocci", line 7, column 0, charpos = 109
  around = '|',
  whole content = |

Full log using genl-const.cocci
init_defs_builtins: /usr/local/lib/coccinelle/standard.h
plus: parse error:
  File "./patches/0027-genl-const/genl-const.cocci", line 7, column 0, charpos = 109
  around = '|',
  whole content = |

init_defs_builtins: /usr/local/lib/coccinelle/standard.h
plus: parse error:
  File "./patches/0027-genl-const/genl-const.cocci", line 7, column 0, charpos = 109
  around = '|',
  whole content = |

init_defs_builtins: /usr/local/lib/coccinelle/standard.h
plus: parse error:
  File "./patches/0027-genl-const/genl-const.cocci", line 7, column 0, charpos = 109
  around = '|',
  whole content = |

init_defs_builtins: /usr/local/lib/coccinelle/standard.h
plus: parse error:
  File "./patches/0027-genl-const/genl-const.cocci", line 7, column 0, charpos = 109
  around = '|',
  whole content = |

Traceback (most recent call last):
  File "./devel/pycocci", line 184, in <module>
    ret = _main()
  File "./devel/pycocci", line 178, in _main
    extra_args=extra_spatch_args)
  File "./devel/pycocci", line 129, in threaded_spatch
    logwrite, print_name)
__main__.ExecutionErrorThread

-----------

peter@peter-dfs:~/works/src/backports/backports$ ./devel/pycocci -j 1 -v ./patches/0001-group-attr/0001-group_attr_class.cocci ./output/
jobs arg: threds: 1
jobs from list:
[]
ret_q:
<multiprocessing.queues.Queue object at 0x7fce47ab5410>
outdir:
./output/
ret_q:
<multiprocessing.queues.Queue object at 0x7fce47ab5410>
extra_args:
[]
num:
0
t:
/tmp/VgXLQj
jobs:
[<Process(Process-1, initial)>]
spatch --sp-file ./patches/0001-group-attr/0001-group_attr_class.cocci --in-place --recursive-includes --relax-include-path --use-coccigrep --timeout 120 --dir ./output/
num:
0
ret:
0
fn:
/tmp/VgXLQj/.tmp_spatch_worker.0
init_defs_builtins: /usr/local/lib/coccinelle/standard.h
5 files match
HANDLING: ./output/compat/drivers-base-devcoredump.c
failed on linux/module.h

failed on linux/device.h

failed on linux/bp-devcoredump.h

failed on linux/vmalloc.h

failed on linux/scatterlist.h

failed on linux/slab.h

failed on linux/list.h

failed on linux/fs.h

failed on linux/workqueue.h

failed on linux/version.h

HANDLING: ./output/net/wireless/sysfs.c
failed on linux/netdevice.h

failed on linux/types.h

failed on linux/rtnetlink.h

failed on linux/debugfs.h

failed on linux/bug.h

failed on linux/netlink.h

failed on linux/skbuff.h

failed on linux/if_ether.h

failed on linux/etherdevice.h

failed on asm/byteorder.h

failed on asm/unaligned.h

failed on linux/net.h

failed on linux/rcupdate.h

failed on linux/rbtree.h

failed on linux/rfkill.h

failed on net/genetlink.h

failed on linux/tracepoint.h

failed on trace/define_trace.h

failed on sysfs.h

failed on core.h

failed on rdev-ops.h

diff =
diff -u -p a/net/wireless/sysfs.c b/net/wireless/sysfs.c
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -74,11 +74,16 @@ static struct attribute *ieee80211_attrs
  NULL,
 };
 #if LINUX_VERSION_IS_GEQ(3,11,0)
+#if LINUX_VERSION_IS_GEQ(3,11,0)
 ATTRIBUTE_GROUPS(ieee80211);
 #else
 #define BP_ATTR_GRP_STRUCT device_attribute
 ATTRIBUTE_GROUPS_BACKPORT(ieee80211);
 #endif
+#else
+#define BP_ATTR_GRP_STRUCT device_attribute
+ATTRIBUTE_GROUPS_BACKPORT(ieee80211);
+#endif

 static void wiphy_dev_release(struct device *dev)
 {
@@ -163,11 +168,16 @@ struct class ieee80211_class = {
  .owner = THIS_MODULE,
  .dev_release = wiphy_dev_release,
 #if LINUX_VERSION_IS_GEQ(3,11,0)
+#if LINUX_VERSION_IS_GEQ(3,11,0)
  .dev_groups = ieee80211_groups,
 #else
  .dev_attrs = ieee80211_dev_attrs,
 #endif

+#else
+ .dev_attrs = ieee80211_dev_attrs,
+#endif
+
  .dev_uevent = wiphy_uevent,
  .pm = WIPHY_PM_OPS,
  .ns_type = &net_ns_type_operations,
@@ -177,6 +187,7 @@ struct class ieee80211_class = {
 int wiphy_sysfs_init(void)
 {
  init_ieee80211_attrs();
+ init_ieee80211_attrs();
  return class_register(&ieee80211_class);
 }

HANDLING: ./output/drivers/bcma/main.c
failed on linux/pci.h

failed on linux/mod_devicetable.h

failed on linux/platform_device.h

failed on linux/gpio.h

failed on linux/spinlock.h

failed on linux/dma-mapping.h

failed on linux/delay.h

failed on linux/mmc/sdio_func.h

failed on linux/of_address.h

failed on linux/of_irq.h

failed on linux/of_platform.h

HANDLING: ./output/drivers/net/wireless/ath/ath10k/thermal.c
failed on linux/sysfs.h

failed on linux/thermal.h

failed on linux/hwmon.h

failed on linux/hwmon-sysfs.h

failed on linux/completion.h

failed on linux/uuid.h

failed on linux/time.h

failed on linux/idr.h

failed on linux/interrupt.h

failed on linux/dmapool.h

failed on linux/kernel.h

failed on linux/hash.h

failed on linux/rculist.h

failed on linux/kfifo.h

failed on linux/ktime.h

failed on net/pkt_sched.h

failed on net/inet_ecn.h

failed on linux/timer.h

HANDLING: ./output/drivers/ssb/main.c
failed on linux/watchdog.h

failed on linux/io.h

failed on pcmcia/cistpl.h

failed on pcmcia/ds.h

peter@peter-dfs:~/works/src/backports/backports$ 


#############

spatch version 1.0.4 with Python support and with PCRE support
-->> working, install by "sudo apt install coccinelle"

spatch version 1.0.0-rc24 without Python support and with Str regexp support
-->> not working

qsdk$ ./staging_dir/host/bin/spatch --version
spatch version 1.0.0-rc24 with Python support and with Str regexp support
-->> working

**** "with Python support" makes build work ??

--------------------------------------------------------------------------------------------------
The error is because spatch(pycocci) does not parse the xxx.cocci file.
Rebuild coccinelle after install the packages below.
On Debian/Ubuntu, install the following packages
 - pkg-config (optional, but strongly recommended)
 - ocaml-native-compilers (or alternatively ocaml)
 - ocaml-findlib
 - menhir and libmenhir-ocaml-dev (optional, bundled)
 - libpcre-ocaml-dev (optional, bundled) /* This is required for the latest backport parser */
 - texlive-fonts-extra (for the documentation)

./autogen
./configure
./make
sudo make install

--------------------------------------------------------------------------------------------------

backports_output/versions sample-1
BACKPORTS_VERSION="v4.14-rc2-1-8-gba9e884"
BACKPORTED_KERNEL_VERSION="v3.18-223820-g6ead261"
BACKPORTED_KERNEL_NAME="Linux"

backports_output/versions sample-2

BACKPORTS_VERSION="v4.14-rc2-1-8-gba9e884"
BACKPORTED_KERNEL_VERSION="v4.14-rc1-236-gc09dbd7"
BACKPORTED_KERNEL_NAME="Linux"

backports_output/Makefile.real
include versions
export BACKPORTS_VERSION BACKPORTED_KERNEL_VERSION BACKPORTED_KERNEL_NAME

backports_output/Makefile.kernel
-DCPTCFG_KERNEL_VERSION=\"$(BACKPORTED_KERNEL_VERSION)\" \

backports_output/Kconfig
mainmenu "Backports from $BACKPORTED_KERNEL_NAME $BACKPORTED_KERNEL_VERSION (backports $BACKPORTS_VERSION)"

config BACKPORTED_KERNEL_VERSION
string
option env="BACKPORTED_KERNEL_VERSION"


gentree.py
        kernel_version = git.describe(rev=args.git_revision or 'HEAD',
                                      tree=args.kerneldir,
                                      extra_args=['--long'])
        f = open(os.path.join(bpid.target_dir, 'versions'), 'w')
        f.write('BACKPORTS_VERSION="%s"\n' % backports_version)
        f.write('BACKPORTED_KERNEL_VERSION="%s"\n' % kernel_version)
        f.write('BACKPORTED_KERNEL_NAME="%s"\n' % args.base_name)

        kernel_version = git.describe(rev=args.git_revision or 'HEAD',
                                      tree=args.kerneldir,
                                      extra_args=['--long'])

mac80211-kernel$ git describe --long
v3.18-223820-gc4ad22c

tmp/dl/mac80211-kernel$ git describe --long
v4.14-rc1-236-gc09dbd7

backports_output/versions sample-1
  BACKPORTED_KERNEL_VERSION="v3.18-223820-g6ead261"

backports_output/versions sample-2
  BACKPORTED_KERNEL_VERSION="v4.14-rc1-236-gc09dbd7"

-------------------------------------------------------------------------------------------------------
src/linux-3.14$ cat .git/config
[remote "origin"]
url = https://kernel.org/linux-kernel
projectname = kernel/ath

src/linux-3.14$ cat .git/config
[remote "origin"]
url = ssh://git@github.com/linux-3.14
projectname = kernel/local-ath

----------------------------------------------------------------------------------------------------------

GIT-DESCRIBE(1)                                                     Git Manual                                                    GIT-DESCRIBE(1)

NAME
       git-describe - Describe a commit using the most recent tag reachable from it

SYNOPSIS
       git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]
       git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]

DESCRIPTION
       The command finds the most recent tag that is reachable from a commit. If the tag points to the commit, then only the tag is shown.
       Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object and the abbreviated object name of
       the most recent commit.

       By default (without --all or --tags) git describe only shows annotated tags. For more information about creating annotated tags see the -a
       and -s options to git-tag(1).

OPTIONS
       <commit-ish>...
           Commit-ish object names to describe. Defaults to HEAD if omitted.

       --dirty[=<mark>]
           Describe the working tree. It means describe HEAD and appends <mark> (-dirty by default) if the working tree is dirty.

       --all
           Instead of using only the annotated tags, use any ref found in refs/ namespace. This option enables matching any known branch,
           remote-tracking branch, or lightweight tag.

       --tags
           Instead of using only the annotated tags, use any tag found in refs/tags namespace. This option enables matching a lightweight
           (non-annotated) tag.

       --contains
           Instead of finding the tag that predates the commit, find the tag that comes after the commit, and thus contains it. Automatically
           implies --tags.

       --abbrev=<n>
           Instead of using the default 7 hexadecimal digits as the abbreviated object name, use <n> digits, or as many digits as needed to form
           a unique object name. An <n> of 0 will suppress long format, only showing the closest tag.

       --candidates=<n>
           Instead of considering only the 10 most recent tags as candidates to describe the input commit-ish consider up to <n> candidates.
           Increasing <n> above 10 will take slightly longer but may produce a more accurate result. An <n> of 0 will cause only exact matches to
           be output.

       --exact-match
           Only output exact matches (a tag directly references the supplied commit). This is a synonym for --candidates=0.

       --debug
           Verbosely display information about the searching strategy being employed to standard error. The tag name will still be printed to
           standard out.

       --long
           Always output the long format (the tag, the number of commits and the abbreviated commit name) even when it matches a tag. This is
           useful when you want to see parts of the commit object name in "describe" output, even when the commit in question happens to be a
           tagged version. Instead of just emitting the tag name, it will describe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2
           that points at object deadbee....).

       --match <pattern>
           Only consider tags matching the given glob(7) pattern, excluding the "refs/tags/" prefix. This can be used to avoid leaking private
           tags from the repository.

       --always
           Show uniquely abbreviated commit object as fallback.

       --first-parent
           Follow only the first parent commit upon seeing a merge commit. This is useful when you wish to not match tags on branches merged in
           the history of the target commit.

EXAMPLES
       With something like git.git current tree, I get:

           [torvalds@g5 git]$ git describe parent
           v1.0.4-14-g2414721

       i.e. the current head of my "parent" branch is based on v1.0.4, but since it has a few commits on top of that, describe has added the
       number of additional commits ("14") and an abbreviated object name for the commit itself ("2414721") at the end.

       The number of additional commits is the number of commits which would be displayed by "git log v1.0.4..parent". The hash suffix is "-g" +
       7-char abbreviation for the tip commit of parent (which was 2414721b194453f058079d897d13c4e377f92dc6). The "g" prefix stands for "git" and
       is used to allow describing the version of a software depending on the SCM the software is managed with. This is useful in an environment
       where people may use different SCMs.

       Doing a git describe on a tag-name will just show the tag name:

           [torvalds@g5 git]$ git describe v1.0.4
           v1.0.4

       With --all, the command can use branch heads as references, so the output shows the reference path as well:

           [torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
           tags/v1.0.0-21-g975b

           [torvalds@g5 git]$ git describe --all --abbrev=4 HEAD^
           heads/lt/describe-7-g975b

       With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:

           [torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
           tags/v1.0.0

       Note that the suffix you get if you type these commands today may be longer than what Linus saw above when he ran these commands, as your
       Git repository may have new commits whose object names begin with 975b that did not exist back then, and "-g975b" suffix alone may not be
       sufficient to disambiguate these commits.

SEARCH STRATEGY
       For each commit-ish supplied, git describe will first look for a tag which tags exactly that commit. Annotated tags will always be
       preferred over lightweight tags, and tags with newer dates will always be preferred over tags with older dates. If an exact match is
       found, its name will be output and searching will stop.

       If an exact match was not found, git describe will walk back through the commit history to locate an ancestor commit which has been
       tagged. The ancestor’s tag will be output along with an abbreviation of the input commit-ish’s SHA-1. If --first-parent was specified then
       the walk will only consider the first parent of each commit.

       If multiple tags were found during the walk then the tag which has the fewest commits different from the input commit-ish will be selected
       and output. Here fewest commits different is defined as the number of commits which would be shown by git log tag..input will be the
       smallest number of commits possible.

GIT
       Part of the git(1) suite

Git 2.7.4                                                           03/23/2016                                                    GIT-DESCRIBE(1)

###################################################################
to debug in verbose
###################################################################
cd tmp/dl/mac80211-source
mac80211-source$ ./gentree.py --verbose --clean --copy-list ./copy-list.ath tmp/dl/mac80211-kernel tmp/dl/backports-xxx

No comments:

Post a Comment