Noach was a righteous man, with good deeds, the main generations of the righteous. He was perfect in his generations who walked in the ways of Hashem who encouraged him, unlike Avraham who would strengthened himself in his righteousness. If Noach would have lived in the Generation of Avraham in some ways he would have been more righteous but in other ways he would not have been considered of any importance. Noach had three sons; Shem, Cham, and Yafes. Noach's family was listed to indicate that now all the earlier generations were irrelevant.
The world became corrupted with immorality idolatry and full of robbery. These were all caused by their opposition to the Tzadikim of their generation; Mesushelach and Noach, and not receiving their oral teaching of Holiness leading them to twist all the teachings. Hashem saw the corruption and how all creatures including cattle, beasts and birds had corrupted their ways by mating with members of other species.
Hashem told Noach that he plans on destroying all life on the world due to their immorality and idolatry which brings death to the world, killing both good and bad. Despite this their final verdict was sealed only because of mass robbery. Even the earth would be destroyed, blotted out and obliterated to the depth of a plowshare, 3 Tefachim, roughly a foot (27 cm).
Instruction of Ark
Hashem told Noach to make for himself an ark of gopher wood, which sounds like gophris - sulphur which they were decreed to be destroyed with. He should make the ark with compartments which would serve as dwelling places for the domestic animals and wild beasts. He was to caulk it both inside and outside with pitch, due to the strength of the water. Moshe's ark which was in calm waters was coated with clay inside and pitch only on the outside. Also so the righteous Moshe should not smell the bad odor of pitch.
Noach was to size it: 300 cubits long, 50 cubits wide and 30 cubits high. He was to make a window which would server as a skylight for the ark as well as a precious stone, which would generate light.
Its roof should slant upwards narrowing to the width of one cubit which was flat and was not pointed to the end, so the waters should run down. It should have a door on its side, so that the rain should not enter it. It would have three stories one above the other, a bottom for garbage, second story for animal dwelling, and an upper third story for the people.
Although Hashem had many ways to save Noach, he did so through the ark, giving his generation a chance to repent as they inquired about Noach working on it for 120 years and replied that Hashem planed on bringing a flood to the world.
Hashem announced that He is bringing a flood of water upon the earth, to destroy all flesh in which there is the spirit of life, from beneath the heavens. Hashem was now ready to agree to the angels who urged Him long ago not to create man. All that is upon the earth would perish. This flood would wear everything out, mix everything up and move everything from high ground to low ground and floated everything down to Bavel which is deep, it was therefore called a בלה, בלבל, הוביל - מבול.
Hashem will uphold His covenant with Noach that the fruits will not rot and become moldy and that he should not be killed by the wicked of his generation. Noach is to enter the ark with his sons, wife and daughter-in-laws, they are prohibited to have marital relations.
Noach is to bring with him into the ark at least two of each living thing, of all flesh, to preserve their life. These should include one male and one female. This included even demons. Two from each kind of bird, animal and ground creeper, that did not have relations with other species and corrupts their way, will come on their own to Noach so he could preserve their life. Those that whom the ark let them enter and did not reject, were to be saved.
Noach is to take for himself and gather every food that is eaten and it should be for him and them to eat. Noach did according to all that Hashem had commanded him, specifically the building of the ark.
Entering Ark Command
Hashem told Noach to enter the ark along with his household for he has found him a righteous man in his generation. This praise was in front of Noach, therefore Hashem did not call him a 'perfectly righteous man' since we tell only partial praise in a person’s presence and all of it in his absence. 
From all the clean animals Noach should take seven pairs of husband and wife. From the animals that are not clean, Noach should only take two, a single husband and wife. Since Noach studied Torah he knew which animals were going to distained to be pure for the Jewish Nation. More kosher animal were taken, so Noach could offer sacrifices from them upon leaving the ark. Also, from the clean birds of the skies, Noach was to take seven pairs, male and female, to keep their seed alive on the face of the earth.
Hashem declared that in another seven days, He will make it rain upon the earth for forty days and forty nights, and He will blot out all beings that He created off the face of the earth. Hashem took into consideration the honor of the tzadik Mesushelach who had passed away when Noach turned 600 and delayed the retribution for an additional seven days of his mourning, above the originally decreed 120 year period. A flood of 40 days was decreed upon them, corresponding to the 40 days it takes to form a fetus, as retribution for burdening their Creator to to form illegitimate children.
Noach did all that Hashem commanded him and entered the Ark.
Entering the Ark
Noach was 600 years old when the when the waters flooded the earth. Noach, his 3 sons, his wife and 3 daughter-in-laws entered the ark because of the waters of the flood. The men entered separately from the women to symbolize that it they were prohibited to have martital relations while the world what suffering. Noach had little faith and was not fully certain the flood would take place, he therefore did not enter the ark until he was forced to by the water. Sets of two, male and female from the clean animals, unclean animals, birds and land creeps arrived on their own to Noach and the ark, just like Hashem commanded. At least one set of two arrived from each species.
The people of his generation threatened to kill Noach and break the ark, if they see him entering it. Hashem announced that he would bring Noach into the ark before their eyes and they would see whose plan prevailed. Therefore Noach entered the ark in middle of the day with his sons; Shem, Cham and Yefes, along with his wife and the daughter in laws. They were accompanied by every type of beast, domestic animal, land creeper, birds and flying creatures with appearance of feathers, including locusts.  All flesh that contained spirit of life, came in sets of two, male and female to Noach and the ark, as Hashem had commanded him. Hashem then shut him in the ark, sealing it from water and protecting him from the masses who wanted to break the ark by surrounding it with bear and lions who would kill them.
After the seven day extension, on the 600th year of Noach's life, on the 17th of the second month of the year (Which was either Cheshvon or Iyar), all the springs of the great depths ruptured to emit their waters and the portals of the sky opened bringing the flood waters upon the earth. Sine that generation had sinned with 'great' evil they were now punished measure for measure with the waters of the 'great' depths.
Hashem began the flood with mercy bringdown light rains that would have concluded as rains of blessing had they repented. When they did not, it turned into a flood. There was rain upon the earth for forty days and forty nights, lasting until the 28th of Kislev (12 Cheshvon + 28 Kislev). In truth, it rained for 41 days but the first was not counted since it did not rain during its proceeding night.
Permitting of Meat
They were now permitted to eat animal meat which had not been allowed until then, just like they had been permitted to eat vegetation at the time of Adom.
Genealogy of Shem
The descendants of Shem are listed to indicate that now the families of Yefes and Cham were considered irrelevant.
- ^ a b c d e Rashi Berashis 6:9
- ^ a b c Shover Zadim Parshas Noach
- ^ a b Baal Haturim Berashis 6:1
- ^ a b c Rashi Berashis 6:11
- ^ a b c Likutay Halachos, Hilchos Reshis Hagaz 5
- ^ Rashi Berashis 6:12
- ^ a b c Rashi Berashis 6:13
- ^ a b c d e f Rashi Berashis 6:14
- ^ a b c d e f Rashi Berashis 6:16
- ^ a b c Rashi Berashis 6:17
- ^ a b c Rashi Berashis 6:18
- ^ a b c Rashi Berashis 6:19
- ^ a b c Rashi Berashis 6:20
- ^ Rashi Berashis 6:22
- ^ Rashi Berashis 7:1
- ^ a b Rashi Berashis 7:2
- ^ Rashi Berashis 7:3
- ^ a b c d Rashi Berashis 7:4
- ^ Rashi Berashis 7:5
- ^ a b Rashi Berashis 7:7
- ^ a b Rashi Berashis 7:9
- ^ Rashi Berashis 7:13
- ^ a b Rashi Berashis 7:14
- ^ a b Rashi Berashis 7:16
- ^ a b c Rashi Berashis 7:11
- ^ a b c d Rashi Berashis 7:12
- ^ Rashi Berashis 30