Q:

What prompted Knut Hamsun to write his eulogy for Hitler?

Knut Hamsun, a Norwegian writer famous for writing Hunger and awarded the Nobel literature prize in the 1920s, sent Goebbels, Hitler's minister for Propaganda, his Nobel medal in 1943 as a gift, wrote a week after Hitler died:

He was a warrior, a warrior for mankind, and a prophet for the gospel of justice for all nations. 

What did Knut Hamsun by this and was he aware of the holocaust when he wrote it? And did he write this because of it, or despite it, or from ignorance of it?

A:

It depends who do you ask, but it seems simply that he was a Nazi sympathiser
While the official "Hamsun Online" site states that he wasn't a Nazi because his works don't express Nazi ideology (at the same time, I've found a neo-nazi site, that was saying something exactly opposite, but I don't feel comfortable providing links to it) and because "he had an argument with Hitler"*, you can't ignore the fact, that he gave his Nobel prize to Goebbels, he supported Germany in invasion of Soviet Union and war with Great Britain (he was a serious anglophobe) and (arguably) the occupation of Norway.
Yet indeed, he was acquitted after the war: he was found too old and too senile to be convicted and he pleaded ignorance regarding the Nazi war crimes.
Sources: 

https://www.nytimes.com/2009/02/28/books/28hams.html
https://www.theguardian.com/books/booksblog/2008/sep/10/knut.hamsun.nazi
https://www.newsinenglish.no/2014/10/13/hamsuns-meeting-with-adolph-hitler/

* In this meeting, Hamsun was trying to convince Hitler to strengthen the power of head of the puppet government Vidkun Quisling, while Hitler was trying to use Hamsun to raise the morale of German elites. Indeed the meeting ended with furious Hitler and Hamsun in tears. 

