Basically, you can make your own rocket engine. However, Consider the following:
1) It is dangerous. It can blowup or rupture damaging you, your loved ones, and your rocket.
2) The ones on the market are really low in cost. You can buy a pack of 4 for $5.00. Why would you go through the effort of making one when you can easilly buy get them?
But to answer your question concerning the ejection charge and engine construction, having played with them enough as a kid, here's my synopsis of how a rocket engine chute deployment charge works for a simple solid propellant engine.
Basically, as the rocket motor burns and it uses up it's fuel the leftover hot gases ignite a fuse leading leading to the charge chamber. The gases in the charge chamber will have no where to expand but out through the top of the chamber thus deploying your chute.
PS I could tell you how to build a simple rocket engine but I don't know who you are or what you'd ultimately use the device for. As a result, I will not give you the details of engine construction.
Good luck.