This paper is concerned with the energy shaping of 1D linear boundary controlled port-Hamiltonian systems. The energy-Casimir method is first proposed to deal with power preserving systems. It is shown how to use finite dimensional dynamic boundary controllers and closed-loop structural invariants to partially shape the closed-loop energy function and how such controller finally reduces to a state feedback. When dissipative port-Hamiltonian systems are considered, the Casimir functions do not exist anymore (dissipation obstacle) and the immersion (via a dynamic controller) / reduction (through invariants) method cannot be applied. The main contribution of this paper is to show how to use the same ideas and state functions to shape the close...