What is a cornerstone?

I wonder where you can find a cornerstone. What is a cornerstone? Is it a stone put at the corner of the road? Is it a stone put at the place where two walls meet orthogonally ? Is it one of the stones which the base of the house is composed of?

According to our Stevens, drawing up a good staff plan is the “cornerstone” of any decent butler’s skills. I wonder where this expression comes from.

The cornerstone was the first stone set in the building of the foundations of medieval buildings - so was the foundation on which everything rested. Hence the expression.