Deriving Precoding information and Number of layers

Hi Experts,

In codebook based UL transmission, How does gNB/Base station measure SRS received across multiple antenna ports to derive srs resource indicator(SRI), precoding information (TPMI), Number of layers?

I could not find any better sources to understand this. Please help.