  We consider the production of $^6$Li in spallation reactions by cosmic rays
in order to explain the observed abundance in halo metal-poor stars. We show
that heating of ambient gas by cosmic rays is an inevitable consequence of this
process, and estimate the energy input required to reproduce the observed
abundance of $^6$Li/H$\sim 10^{-11}$ to be of order a few hundred eV per
particle. We draw attention to the possibility that this could explain the
excess entropy in gas in galaxy groups and clusters. The evolution of $^6$Li
and the accompanying heating of gas is calculated for structures collapsing at
the present epoch with injection of cosmic rays at high redshift. We determine
the energy required to explain the abundance of $^6$Li at $z \sim 2$
corresponding to the formation epoch of halo metal-poor stars, and also an
increased entropy level of $\sim 300$ keV cm$^2$ necessary to explain X-ray
observations of clusters. The energy budget for this process is consistent with
the expected energy output of radio-loud AGNs, and the diffusion length scale
of cosmic-ray protons responsible for heating is comparable to the size of
regions with excess entropy. We also discuss the constraints imposed by the
extragalactic gamma-ray background.
