Preheat the oven to 350 ° F. Place the onion and ginger on a rimmed baking sheet and roast until the onion is soft and beginning to ooze, about 1 hour. Remove from the oven and let the onion and ginger cool until they can be handled. Peel the onion and cut in half. Slice the unpeeled ginger into ¼-inch-thick coins.
While the onion and ginger are roasting, blanch the bones: To ensure the pot is large enough to blanch the bones without boiling over, put the bones in the pot and add water to cover by 1 inch. Then remove the bones and bring the water to a boil. When it is at a rolling boil, add the oxtails, neck bones, and shanks. Return the water to a boil and boil for 3 minutes. Drain the contents of the pot into a colander and rinse under cold running water. Rinse the pot and return the rinsed oxtails, neck bones, and shanks to the pot. Add the marrowbones.
Add the onion halves, ginger slices, sugar, salt, and 8 quarts fresh water to the pot and bring to a boil over high heat, skimming off any scum that forms on the surface. Lower the heat so the liquid is at a gentle simmer and simmer for 4 hours, skimming as needed to remove any scum that forms on the surface.
Add the pepper, cinnamon, star anise, clove, and cardamom and continue cooking, skimming occasionally, for 1 hour longer.
Remove from the heat and and, using a spider or a slotted spoon, discard the large solids. Strain the stock through a fine-mesh sieve into a large container, let sit for a few minutes (or refrigerate overnight), then skim most of the fat from the surface (leave some, as it gives the stock a better flavor and mouthfeel). Use immediately, or let cool completely, then transfer to practical-size airtight containers and refrigerate for up to 3 days or freeze for up to 3 months.