Earlier this month, a law was passed requiring the government to formally request an extension on 19 October unless a Brexit deal was reached with the European Union or parliament had voted in favour of a no-deal Brexit.
Mr Johnson has previously said he would rather “die in a ditch” than obey the law. Mr Cameron told Sky News’ Sophy Ridge On Sunday programme that he and Mr Johnson are “as one” on the importance of getting a Brexit deal.
He said: “No deal is not a good idea. Breaking the law is not a good idea. Focus everything you’ve got on getting that deal, and that’s what he’s doing, to be fair to him.”
Mr Cameron said he and Mr Johnson text each other “from time to time” but they had not met since the latter became prime minister.
“He knows my views on most things,” Mr Cameron added. “The most important thing he is trying to do, he has my support for, which is going to Brussels, getting a deal, bringing that deal back and trying to end this period of uncertainty and I wish him well as he does that.”
In the interview, Mr Cameron also addressed knife crime, admitting that there had been a link between a rise and the cut of 20,000 police officers, but said changes to stop and search would have more of an impact.
He told Sophy Ridge on Sunday: “What we demonstrated was actually you could reduce police budgets while continuing to cut crime and actually trying to increase the number of neighbourhood officers that were on the front line and that is what happened.
“There was wastage and inefficiency in a lot of these public services and we had to do something about that.”
Pressed on how the impact of those cuts on today’s violent crimes, Mr Cameron admitted: “Knife crime has many causes, and there are many things that we need to do to tackle it.
“I absolutely think it was right of Sajid Javid when he was home secretary to look again at stop and search because actually the number of police officers clearly has an impact – but as big an impact is what they are doing.
“As we reduced these budgets, we were able to make sure that there was more on the front line – that’s absolutely crucial.
“But if you’re asking me did we make difficult decisions, yes of course we did. But we had no choice.
“I’ve been quiet for the last three years but sometimes you’re driven mad to hear that somehow austerity was a ‘political choice’, that there were other alternatives.”
Mr Cameron praised his former parliamentary secretary Sam Gyimah, who made a shock move to the Liberal Democrats just weeks after running to be Conservative leader, but said he had made the wrong choice.
He said: “I think Sam, who I admire enormously, he’s a friend and was a great PPS to me, I think he has made the wrong choice because although Brexit dominates everything at the moment, if for one moment you just leave it to one side and look at what the Conservative Party is today, it is totally different to the one that I inherited in 2005.
“It has got a far better gender balance, it’s got far more people from across the country, it represents seats in the North, the Midlands and not just the South, and if you listen to the concerns of the Conservative MPs, they are talking about educational reform and stalled opportunity and tackling modern slavery and all those issues, and environmentalism and green causes.
“So, we need to deal with Brexit. But is the cause of a modern compassionate Conservative Party lost? Absolutely not.”
The former prime minister also spoke about his family, following a controversial editorial in The Guardian which said he suffered “privileged pain” during the treatment and subsequent death of his severely disabled son Ivan.
He said: “The intensity, when you have a profoundly disabled child, of social workers, night carers, tubes, medicines, tube feedings, seizures, A&E over and over again, nights in hospitals, different hospitals, different scans, different checks, different tests, the intensity of it all and the amazing side of our health service you see, district nurses that are just incredibly dedicated, I think that gives you a perspective.”
Mr Cameron said it brought the family closer together as they got through it.
He also credited his wife Samantha with bringing in equal marriage, saying that her “very good 40,000ft view” helped him see the big picture.
He said: “I was sort of like the man under the bonnet, trying to fix, well, it’s not fair if gay couples can’t inherit property or have hospital visiting rights or let’s fix this and she was sort of going, ‘well, never mind all that’.
“‘If gay people want to get married, that doesn’t make our marriage worth less. Why not have proper marriage equality’ and that was when the sort of lightbulb went off.”