Deuteronomy 21 16
then it shall be on the day that he wills what he owns as an inheritance to his sons, he is not allowed to treat the son of the loved wife as the firstborn, at the expense of the son of the unloved, who actually is the firstborn son.