  A general $f(\mathcal{R})$ gravitational theory is considered within the
Palatini formalism. By applying the variational principle and the usual
conditions on the boundary, we show explicitly that a surface term remains such
that as in their metric-compatible counterparts, an additional surface term has
to be added in the gravitational action, which plays a fundamental role when
calculating the entropy of the black hole.
