Abstract. We exhibit a large class of Lyapunov functionals for nonlinear drift-diffusion equations with non-homogeneous Dirichlet boundary conditions. These are generalizations of large deviation functionals for underlying stochastic many-particle systems, the zero range process and the Ginzburg-Landau dynamics, which we describe briefly. As an application, we prove linear inequalities between such an entropy-like functional and its entropy production functional for the boundary-driven porous medium equation in a bounded domain with positive Dirichlet conditions: this implies exponential rates of relaxation related to the first Dirichlet eigenvalue of the domain. We also derive Lyapunov functions for systems of nonlinear diffusion equations, and for nonlinear Markov processes with non-reversible stationary measures.