You're on the right track to fix the 171 code. I would replace the torn intake boot first, but it is very likely that you will also need to replace the MAF. It is a common failure on the later P11s. The knock sensor code is pretty straightforward and also very common. You'll need to replace the knock sensor to get it to clear.