My understanding is if your equation is
then the Green's function is the solution to
So when you solve this equation you have in the first case
multiply by the integrating factor you have
Enforcing the boundary condition and assuming we can deduce and therefore
Hope this helps. You might need to give more complete details to answer the second part.