Deuteronomy 21:15-17

BSB(i) 15 If a man has two wives, one beloved and the other unloved, and both bear him sons, but the unloved wife has the firstborn son, 16 when that man assigns his inheritance to his sons he must not appoint the son of the beloved wife as the firstborn over the son of the unloved wife. 17 Instead, he must acknowledge the firstborn, the son of his unloved wife, by giving him a double portion of all that he has. For that son is the firstfruits of his father’s strength; the right of the firstborn belongs to him.