On corruption, an issue often blamed for holding back investment, Obama said money spent on bribes would be better paid to someone doing an honest day's work.
U.S. President Barack Obama told Kenyans on Sunday on his first presidential trip to his father's homeland there was "no limit to what you can achieve" but said they had to deepen democracy, tackle corruption and end exclusion based on gender or ethnicity.
After political talks on Saturday with President Uhuru Kenyatta on security and business, his speech to a packed sports hall in Nairobi struck a personal note, talking of his own experience and Kenya's in the five decades since independence.
Kenya was the first leg of a trip to Africa, before he flew to neighbouring Ethiopia, one of the continent's fastest-growing economies and headquarters for the 54-nation African Union.
"I'm here as president of a country that sees Kenya as an important partner. I'm here as a friend who wants Kenya to succeed," he said in the Nairobi arena, after being introduced by his sister Auma Obama to a crowd of 4,500 people.
To a mixture of applause and laughter, he described being picked up at the airport on his first visit to Kenya in the 1980s by his sister in an old VW Beetle that often broke down. This time, he arrived on Air Force One and travelled in the president's armoured car nicknamed "the Beast."
"When it comes to the people of Kenya, particularly the youth, I believe there is no limit to what you can achieve," he said, but he told Kenyans that building their nation and the economy required personal effort and responsibility.
On corruption, an issue often blamed for holding back investment, Obama said money spent on bribes would be better paid to someone "doing an honest day's work."
Referring to ethnic fighting in which 1,200 people died after a disputed 2007 election, he told Kenyans that politics based on ethnicity was "doomed to tear a country apart."
He also warned Kenya would "not succeed if it treats women and girls as second-class citizens."