Deuteronomy 21:17

17 He must acknowledge as firstborn the son of the one who is disliked, giving him a double portion of all that he has; since he is the first issue of his virility, the right of the firstborn is his.

Deuteronomy 21:17 In-Context

15 If a man has two wives, one of them loved and the other disliked, and if both the loved and the disliked have borne him sons, the firstborn being the son of the one who is disliked,
16 then on the day when he wills his possessions to his sons, he is not permitted to treat the son of the loved as the firstborn in preference to the son of the disliked, who is the firstborn.
17 He must acknowledge as firstborn the son of the one who is disliked, giving him a double portion of all that he has; since he is the first issue of his virility, the right of the firstborn is his.
18 If someone has a stubborn and rebellious son who will not obey his father and mother, who does not heed them when they discipline him,
19 then his father and his mother shall take hold of him and bring him out to the elders of his town at the gate of that place.

Footnotes 1

New Revised Standard Version Bible, copyright 1989, Division of Christian Education of the National Council of the Churches of Christ in the United States of America. Used by permission. All rights reserved.