(CNN) Rapper Soulja Boy will serve 240 days in jail for violating his probation, according to Los Angeles County court documents.

Soulja, whose real name is DeAndre Cortez Way, appeared in court Tuesday. The judge gave him 40 days credit on the sentence for having been locked up the last 20 days.

It wasn't immediately known what he did to violate his probation.

Way was convicted in 2014 for carrying a loaded weapon in a car in which he was a passenger and is barred from possessing guns or ammunition.

"My client is very thankful to the judge that he was sentenced to only 240 days because the judge was initially contemplating a sentence of two years," said Fred G. Minassian, Soulja's attorney.

Read More